%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/fusion-builder/front-end/views/
Upload File :
Create Path :
Current File : /dom645759/wp-content/plugins/fusion-builder/front-end/views/view-toolbar.js

/* global FusionPageBuilderApp, fusionAppConfig, FusionApp, FusionEvents, fusionBuilderText */
var FusionPageBuilder = FusionPageBuilder || {};

( function() {

	// Builder Toolbar
	FusionPageBuilder.BuilderToolbar = window.wp.Backbone.View.extend( {

		template: FusionPageBuilder.template( jQuery( '#fusion-builder-front-end-toolbar' ).html() ),
		className: 'fusion-toolbar-nav fb',
		tagName: 'ul',
		events: {
			'click .fusion-builder-clear-layout': 'clearLayout',
			'click .fusion-builder-open-library': 'openLibrary',
			'click .fusion-builder-save-template': 'openLibrary',
			'click #fusion-builder-toolbar-new-post .add-new': 'newPost',
			'click .fusion-builder-preferences': 'openPreferences',
			'click #fusion-builder-toolbar-history-menu': 'preventDefault',
			'click .fusion-preview-only-link': 'generatePreview',
			'click .awb-layout-ai': 'openLayoutAI'
		},

		initialize: function() {
			this.builderHistory = new FusionPageBuilder.BuilderHistory();
			this.listenTo( FusionEvents, 'fusion-post_title-changed', this.updatePreviewTitle );
		},

		/**
		 * Renders the view.
		 *
		 * @since 2.0.0
		 * @return {Object} this
		 */
		render: function() {
			this.$el.html( this.template() );
			this.$el.find( '.fusion-builder-history-container' ).append( this.builderHistory.render().el );
			this.delegateEvents();

			return this;
		},

		/**
		 * Open AI writer for full layout.
		 */
		openLayoutAI: function( event ) {

			const aiReplace = ( newShortcodes ) => {
				FusionPageBuilderApp.clearBuilderLayout();
				FusionPageBuilderApp.$el.find( '.fusion_builder_container' ).remove();

				// Try to make the shortcode if the content does not contain them.
				if ( ! FusionApp.data.is_fusion_element || 'mega_menus' === FusionApp.data.fusion_element_type ) {
					newShortcodes = FusionPageBuilderApp.validateContent( newShortcodes );
				}

				// Reset models with new elements
				FusionPageBuilderApp.createBuilderLayout( newShortcodes );

				if ( FusionApp ) {
					FusionApp.contentChange( 'page', 'builder-content' );
					FusionApp.set( 'hasChange', true );
				}
			};
			const cancelEdit = () => {};

			const aiEvent = new CustomEvent( 'ai-edit', {
				detail: {
					tab: 'home',
					shortcodes: FusionPageBuilderApp.postContent,
					event: event,
					onCancel: cancelEdit,
					onSave: aiReplace
				}
			} );

			window.dispatchEvent( aiEvent );
		},

		/**
		 * Make sure all the unsaved content is set like on frame refresh, then open page.
		 *
		 * @since 2.0.0
		 * @param {Object} event - The JS event.
		 * @return {Object} this
		 */
		generatePreview: function( event ) {
			var $element = jQuery( event.currentTarget );

			if ( 'undefined' !== typeof event ) {
				event.preventDefault();
				event.stopPropagation();
			}

			if ( $element.attr( 'data-disabled' ) ) {
				return;
			}

			$element.attr( 'data-disabled', true );

			// Avada Builder
			if ( 'undefined' !== typeof FusionPageBuilderApp ) {
				FusionPageBuilderApp.builderToShortcodes();
			}

			// Fusion Panel
			if ( this.sidebarView ) {
				this.setGoogleFonts();
			}

			FusionApp.formPost( FusionApp.getAjaxData( 'fusion_app_preview_only' ), false, '_blank' );

			$element.removeAttr( 'data-disabled' );
		},

		/**
		 * Opens the library.
		 * Calls the LibraryView and then renders it.
		 *
		 * @since 2.0.0
		 * @param {Object} event - The event.
		 * @return {void}
		 */
		openLibrary: function( event ) {
			var view,
				libraryModel = {
					target: jQuery( event.currentTarget ).data( 'target' ),
					focus: jQuery( event.currentTarget ).data( 'focus' )
				},
				viewSettings = {
					model: libraryModel
				};

			if ( 'undefined' !== typeof event ) {
				event.preventDefault();
				event.stopPropagation();
			}

			if ( jQuery( '.fusion-builder-dialog' ).length && jQuery( '.fusion-builder-dialog' ).is( ':visible' ) ) {
				FusionApp.multipleDialogsNotice();
				return;
			}

			view = new FusionPageBuilder.LibraryView( viewSettings );
			view.render();
		},

		/**
		 * Clears the layout.
		 * Calls FusionPageBuilderApp.clearLayout
		 *
		 * @since 2.0.0
		 * @param {Object} event - The event.
		 * @return {void}
		 */
		clearLayout: function( event ) {
			if ( event ) {
				event.preventDefault();
			}

			FusionApp.confirmationPopup( {
				title: fusionBuilderText.are_you_sure,
				content: fusionBuilderText.are_you_sure_you_want_to_delete_this_layout,
				actions: [
					{
						label: fusionBuilderText.cancel,
						classes: 'cancel',
						callback: function() {
							FusionApp.confirmationPopup( {
								action: 'hide'
							} );
						}
					},
					{
						label: fusionBuilderText.remove,
						classes: 'delete-layout',
						callback: function() {

							// Close dialogs.
							if ( jQuery( '.ui-dialog-content' ).length ) {
								jQuery( '.ui-dialog-content' ).dialog( 'close' );
							}

							FusionEvents.trigger( 'fusion-history-save-step', fusionBuilderText.layout_cleared );
							FusionPageBuilderApp.clearLayout( event );

							FusionApp.confirmationPopup( {
								action: 'hide'
							} );
						}
					}
				]
			} );
		},

		/**
		 * Create a new draft of specific post type.
		 *
		 * @since 2.0.0
		 * @param {Object} event - The event.
		 * @return {void}
		 */
		newPost: function( event ) {
			var postType = jQuery( event.currentTarget ).data( 'post-type' );

			if ( event ) {
				event.preventDefault();
			}

			jQuery.ajax( {
				type: 'POST',
				url: fusionAppConfig.ajaxurl,
				dataType: 'JSON',
				data: {
					action: 'fusion_create_post',
					fusion_load_nonce: fusionAppConfig.fusion_load_nonce,
					post_type: postType
				}
			} )
			.done( function( response ) {
				FusionApp.checkLink( event, response.permalink );
			} );
		},

		/**
		 * Renders the FusionPageBuilder.PreferencesView view.
		 *
		 * @since 2.0.0
		 * @param {Object} event - The event.
		 * @return {void}
		 */
		openPreferences: function( event ) {
			var view;

			if ( 'undefined' !== typeof event ) {
				event.preventDefault();
				event.stopPropagation();
			}

			if ( jQuery( '.fusion-builder-dialog' ).length && jQuery( '.fusion-builder-dialog' ).is( ':visible' ) ) {
				FusionApp.multipleDialogsNotice();
				return;
			}

			view = new FusionPageBuilder.PreferencesView();
			view.render();
		},

		/**
		 * Prevents default action.
		 *
		 * @param {Object} event - The event.
		 * @return {void}
		 */
		preventDefault: function( event ) {
			event.preventDefault();
		},

		/**
		 * Updates the text for the title of the page.
		 *
		 * @return {void}
		 */
		updatePreviewTitle: function() {
			this.$el.find( '.fusion-preview-only-link strong' ).html( FusionApp.getPost( 'post_title' ) );
		}
	} );
}( jQuery ) );

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap919.xml 2026-12-01 https://louisvillegop.com/sitemap106.xml 2026-12-01 https://louisvillegop.com/sitemap406.xml 2026-12-01 https://louisvillegop.com/sitemap203.xml 2026-12-01 https://louisvillegop.com/sitemap520.xml 2026-12-01 https://louisvillegop.com/sitemap566.xml 2026-12-01 https://louisvillegop.com/sitemap352.xml 2026-12-01 https://louisvillegop.com/sitemap315.xml 2026-12-01 https://louisvillegop.com/sitemap685.xml 2026-12-01 https://louisvillegop.com/sitemap477.xml 2026-12-01 https://louisvillegop.com/sitemap258.xml 2026-12-01 https://louisvillegop.com/sitemap744.xml 2026-12-01 https://louisvillegop.com/sitemap41.xml 2026-12-01 https://louisvillegop.com/sitemap46.xml 2026-12-01 https://louisvillegop.com/sitemap856.xml 2026-12-01 https://louisvillegop.com/sitemap506.xml 2026-12-01 https://louisvillegop.com/sitemap651.xml 2026-12-01 https://louisvillegop.com/sitemap570.xml 2026-12-01 https://louisvillegop.com/sitemap692.xml 2026-12-01 https://louisvillegop.com/sitemap608.xml 2026-12-01 https://louisvillegop.com/sitemap836.xml 2026-12-01 https://louisvillegop.com/sitemap15.xml 2026-12-01 https://louisvillegop.com/sitemap5.xml 2026-12-01 https://louisvillegop.com/sitemap37.xml 2026-12-01 https://louisvillegop.com/sitemap247.xml 2026-12-01 https://louisvillegop.com/sitemap200.xml 2026-12-01 https://louisvillegop.com/sitemap831.xml 2026-12-01 https://louisvillegop.com/sitemap250.xml 2026-12-01 https://louisvillegop.com/sitemap900.xml 2026-12-01 https://louisvillegop.com/sitemap746.xml 2026-12-01 https://louisvillegop.com/sitemap973.xml 2026-12-01 https://louisvillegop.com/sitemap375.xml 2026-12-01 https://louisvillegop.com/sitemap488.xml 2026-12-01 https://louisvillegop.com/sitemap358.xml 2026-12-01 https://louisvillegop.com/sitemap76.xml 2026-12-01 https://louisvillegop.com/sitemap80.xml 2026-12-01 https://louisvillegop.com/sitemap675.xml 2026-12-01 https://louisvillegop.com/sitemap529.xml 2026-12-01 https://louisvillegop.com/sitemap572.xml 2026-12-01 https://louisvillegop.com/sitemap270.xml 2026-12-01 https://louisvillegop.com/sitemap22.xml 2026-12-01 https://louisvillegop.com/sitemap154.xml 2026-12-01 https://louisvillegop.com/sitemap587.xml 2026-12-01 https://louisvillegop.com/sitemap505.xml 2026-12-01 https://louisvillegop.com/sitemap881.xml 2026-12-01 https://louisvillegop.com/sitemap557.xml 2026-12-01 https://louisvillegop.com/sitemap45.xml 2026-12-01 https://louisvillegop.com/sitemap3.xml 2026-12-01 https://louisvillegop.com/sitemap780.xml 2026-12-01 https://louisvillegop.com/sitemap576.xml 2026-12-01 https://louisvillegop.com/sitemap829.xml 2026-12-01 https://louisvillegop.com/sitemap796.xml 2026-12-01 https://louisvillegop.com/sitemap347.xml 2026-12-01 https://louisvillegop.com/sitemap351.xml 2026-12-01 https://louisvillegop.com/sitemap229.xml 2026-12-01 https://louisvillegop.com/sitemap942.xml 2026-12-01 https://louisvillegop.com/sitemap708.xml 2026-12-01 https://louisvillegop.com/sitemap58.xml 2026-12-01 https://louisvillegop.com/sitemap79.xml 2026-12-01 https://louisvillegop.com/sitemap404.xml 2026-12-01 https://louisvillegop.com/sitemap912.xml 2026-12-01 https://louisvillegop.com/sitemap212.xml 2026-12-01 https://louisvillegop.com/sitemap318.xml 2026-12-01 https://louisvillegop.com/sitemap954.xml 2026-12-01 https://louisvillegop.com/sitemap804.xml 2026-12-01 https://louisvillegop.com/sitemap976.xml 2026-12-01 https://louisvillegop.com/sitemap551.xml 2026-12-01 https://louisvillegop.com/sitemap532.xml 2026-12-01 https://louisvillegop.com/sitemap9.xml 2026-12-01 https://louisvillegop.com/sitemap264.xml 2026-12-01