/** * Load interface js and css * * @since 2.1.9 */ function load_frontend_interface() { // Builder main styles $this->load_main_styles(); // Charts wp_enqueue_script('themify-easy-pie-chart'); // Waypoints wp_enqueue_script('theme-waypoints'); // load only when editing and login if (Themify_Builder_Model::is_frontend_editor_page()) { wp_enqueue_style('themify-builder-main', THEMIFY_BUILDER_URI . '/css/themify-builder-main.css', array(), THEMIFY_VERSION); wp_enqueue_style('themify-builder-admin-ui', THEMIFY_BUILDER_URI . '/css/themify-builder-admin-ui.css', array(), THEMIFY_VERSION); wp_enqueue_style('themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION); wp_enqueue_style('google-fonts-builder', themify_https_esc('http://fonts.googleapis.com/css') . '?family=Open+Sans:400,300,600|Montserrat'); wp_enqueue_style('colorpicker', THEMIFY_URI . '/css/jquery.minicolors.css'); // from themify framework // Icon picker wp_enqueue_script('themify-font-icons-js', THEMIFY_URI . '/js/themify.font-icons-select.js', array('jquery'), THEMIFY_VERSION, true); do_action('themify_builder_admin_enqueue', $this); } // lib scripts if (!wp_script_is('themify-carousel-js')) { wp_enqueue_script('themify-carousel-js'); // grab from themify framework } // Check if BigVideo.js is loaded, if it's not, load it after loading Video.js // which is set as dependency under the handler 'themify-videojs-js' if (!wp_script_is('themify-bigvideo-js')) { wp_enqueue_script('themify-bigvideo-js'); } // Check if scroll highlight is loaded. If it's not, load it. $this->load_scroll_highlight(); // module scripts wp_register_script('themify-builder-module-plugins-js', THEMIFY_BUILDER_URI . "/js/themify.builder.module.plugins.js", array('jquery'), THEMIFY_VERSION, true); wp_enqueue_script('themify-builder-module-plugins-js'); wp_register_script('themify-builder-script-js', THEMIFY_BUILDER_URI . "/js/themify.builder.script.js", array('jquery', 'theme-waypoints'), THEMIFY_VERSION, true); wp_enqueue_script('themify-builder-script-js'); wp_localize_script('themify-builder-script-js', 'tbLocalScript', apply_filters('themify_builder_script_vars', array('isTouch' => themify_is_touch() ? true : false, 'isAnimationActive' => Themify_Builder_Model::is_animation_active(), 'isParallaxActive' => Themify_Builder_Model::is_parallax_active(), 'animationInviewSelectors' => self::$inview_selectors, 'createAnimationSelectors' => self::$new_selectors, 'backgroundSlider' => array('autoplay' => 5000, 'speed' => 2000), 'animationOffset' => 100, 'videoPoster' => THEMIFY_BUILDER_URI . '/img/blank.png'))); // Main module scripts $this->load_main_scripts(); if (Themify_Builder_Model::is_frontend_editor_page()) { if (class_exists('Jetpack_VideoPress')) { // Load this so submit_button() is available in VideoPress' print_media_templates(). require_once ABSPATH . 'wp-admin/includes/template.php'; } $enqueue_scripts = array('underscore', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-effects-core', 'media-upload', 'jquery-ui-dialog', 'wpdialogs', 'wpdialogs-popup', 'wplink', 'word-count', 'editor', 'quicktags', 'wp-fullscreen', 'admin-widgets', 'colorpicker-js', 'themify-builder-google-webfont', 'themify-builder-front-ui-js'); // For editor wp_enqueue_style('buttons'); // is mobile version if ($this->isMobile()) { wp_register_script('themify-builder-mobile-ui-js', THEMIFY_BUILDER_URI . "/js/jquery.ui.touch-punch.js", array('jquery'), THEMIFY_VERSION, true); wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('themify-builder-mobile-ui-js'); } foreach ($enqueue_scripts as $script) { switch ($script) { case 'admin-widgets': wp_enqueue_script($script, admin_url('/js/widgets.min.js'), array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable')); break; case 'colorpicker-js': wp_enqueue_script($script, THEMIFY_URI . '/js/jquery.minicolors.js', array('jquery')); // grab from themify framework break; case 'themify-builder-google-webfont': //wp_enqueue_script( $script, themify_https_esc( 'http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js' ) ); break; case 'themify-builder-front-ui-js': // front ui js wp_register_script($script, THEMIFY_BUILDER_URI . "/js/themify.builder.front.ui.js", array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION, true); wp_enqueue_script($script); $gutterClass = Themify_Builder_Model::get_grid_settings('gutter_class'); wp_localize_script($script, 'themifyBuilder', apply_filters('themify_builder_ajax_front_vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'isTouch' => themify_is_touch() ? 'true' : 'false', 'tfb_load_nonce' => wp_create_nonce('tfb_load_nonce'), 'tfb_url' => THEMIFY_BUILDER_URI, 'post_ID' => get_the_ID(), 'dropPlaceHolder' => __('drop module here', 'themify'), 'draggerTitleMiddle' => __('Drag left/right to change columns', 'themify'), 'draggerTitleLast' => __('Drag left to add columns', 'themify'), 'moduleDeleteConfirm' => __('Press OK to remove this module', 'themify'), 'toggleOn' => __('Turn On Builder', 'themify'), 'toggleOff' => __('Turn Off Builder', 'themify'), 'confirm_on_turn_off' => __('Do you want to save the changes made to this page?', 'themify'), 'confirm_on_duplicate_page' => __('Save the Builder before duplicating this page?', 'themify'), 'confirm_on_unload' => __('You have unsaved data.', 'themify'), 'textImportBuilder' => __('Import From', 'themify'), 'textRowStyling' => __('Row Styling', 'themify'), 'importFileConfirm' => __('This import will override all current Builder data. Press OK to continue', 'themify'), 'confirm_template_selected' => __('This will replace your current Builder layout with the Template', 'themify'), 'load_layout_title' => __('Layouts', 'themify'), 'save_as_layout_title' => __('Save as Layout', 'themify'), 'confirm_delete_layout' => __('Are you sure want to delete this layout ?', 'themify'), 'isThemifyTheme' => $this->is_themify_theme() ? 'true' : 'false', 'gutterClass' => $gutterClass, 'subRowDeleteConfirm' => __('Press OK to remove this sub row', 'themify')))); wp_localize_script($script, 'themify_builder_plupload_init', $this->get_builder_plupload_init()); break; default: wp_enqueue_script($script); break; } } } }
/** * Register styles and scripts necessary for Builder template output. * These are enqueued when user initializes Builder or from a template output. * * Registered style handlers: * * Registered script handlers: * themify-builder-module-plugins-js * themify-builder-script-js * * @since 2.1.9 */ function register_frontend_js_css() { // Builder main scripts wp_enqueue_style('themify-builder-style', THEMIFY_BUILDER_URI . '/css/themify-builder-style.css', array(), THEMIFY_VERSION); wp_register_script('themify-builder-module-plugins-js', THEMIFY_BUILDER_URI . '/js/themify.builder.module.plugins.js', array('jquery'), THEMIFY_VERSION, true); wp_enqueue_script('themify-builder-module-plugins-js'); wp_localize_script('themify-builder-module-plugins-js', 'tbLocalScript', apply_filters('themify_builder_script_vars', array('isTouch' => themify_is_touch() ? true : false, 'isAnimationActive' => Themify_Builder_Model::is_animation_active(), 'isParallaxActive' => Themify_Builder_Model::is_parallax_active(), 'animationInviewSelectors' => self::$inview_selectors, 'createAnimationSelectors' => self::$new_selectors, 'backgroundSlider' => array('autoplay' => 5000, 'speed' => 2000), 'animationOffset' => 100, 'videoPoster' => THEMIFY_BUILDER_URI . '/img/blank.png', 'backgroundVideoLoop' => 'yes', 'builder_url' => THEMIFY_BUILDER_URI, 'framework_url' => THEMIFY_URI, 'version' => THEMIFY_VERSION, 'fullwidth_support' => $this->is_fullwidth_layout_supported(), 'fullwidth_container' => 'body', 'loadScrollHighlight' => true))); //Inject variable values in gallery script wp_localize_script('themify-builder-module-plugins-js', 'themifyScript', array('lightbox' => themify_lightbox_vars_init(), 'lightboxContext' => apply_filters('themify_lightbox_context', 'body'), 'isTouch' => wp_is_mobile() ? 'true' : 'false')); //Inject variable values in Scroll-Highlight script wp_localize_script('themify-builder-module-plugins-js', 'tbScrollHighlight', apply_filters('themify_builder_scroll_highlight_vars', array('fixedHeaderSelector' => '', 'speed' => 900, 'navigation' => '#main-nav', 'scrollOffset' => 0))); ////Enqueue main js that will load others needed js wp_register_script('themify-main-script', THEMIFY_URI . '/js/main.js', array('jquery'), THEMIFY_VERSION, true); wp_localize_script('themify-main-script', 'themify_vars', array('version' => THEMIFY_VERSION, 'url' => THEMIFY_URI, 'TB' => 1)); wp_enqueue_script('themify-main-script'); }