/** * Register the stylesheets for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { $wb_plugin_url = WB()->wb_plugin_url(); wp_enqueue_script($this->name . '-bootstrap.min', plugin_dir_url(__FILE__) . 'js/bootstrap.min.js', array('jquery'), '', TRUE); wp_enqueue_script($this->name . '-jquery.mCustomScrollbar.concat.min', plugin_dir_url(__FILE__) . 'js/jquery.mCustomScrollbar.concat.min.js', array('jquery'), '', TRUE); wp_enqueue_script($this->name . '-jquery.confirm', plugin_dir_url(__FILE__) . 'js/jquery.confirm.min.js', array('jquery'), '', TRUE); wp_enqueue_script($this->name . '-position-calculator', plugin_dir_url(__FILE__) . 'js/woo-bag-public-position-calculator.js', array('jquery'), '', TRUE); wp_enqueue_script($this->name . '-jquery.cookie', plugin_dir_url(__FILE__) . 'js/jquery.cookie.js', array('jquery'), '', TRUE); wp_enqueue_script($this->name . '-functions', plugin_dir_url(__FILE__) . 'js/woo-bag-public-functions.js', array('jquery'), $this->version, TRUE); wp_enqueue_script($this->name . '-user-script', $wb_plugin_url . '/admin/js/' . wb_get_user_script_name('_active_script'), array('jquery'), $this->version, TRUE); wp_enqueue_script($this->name . '-frontend', plugin_dir_url(__FILE__) . 'js/woo-bag-public.js', array('jquery'), $this->version, TRUE); wp_localize_script($this->name . '-frontend', 'wb_ajax_url', array('ajaxurl' => admin_url('admin-ajax.php')), $this->version, TRUE); }
/** * Register the JavaScript for the dashboard. * * @since 1.0.0 */ public function enqueue_scripts($hook) { if ('toplevel_page_woo-bag' != $hook && 'woobag_page_woo-setting' != $hook && 'woobag_page_woo-templates' != $hook && 'woobag_page_woo-premium-features' != $hook) { return; } $wb_plugin_url = WB()->wb_plugin_url(); wp_enqueue_script($this->name . '-style', plugin_dir_url(__FILE__) . 'js/style.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name . '-bootstrap.min', $wb_plugin_url . '/public/js/bootstrap.min.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name . '-jquery.mCustomScrollbar.concat.min', $wb_plugin_url . '/public/js/jquery.mCustomScrollbar.concat.min.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name . '-colpick', plugin_dir_url(__FILE__) . 'js/colpick.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name . 'woo-bag-public-functions', $wb_plugin_url . '/public/js/woo-bag-public-functions.js', array('jquery'), $this->version, true); if ($_GET && isset($_GET['action']) && $_GET['action'] == 'edit') { wp_enqueue_script($this->name . '-user-script', plugin_dir_url(__FILE__) . 'js/' . wb_get_user_script_name('_edit_script'), array('jquery'), $this->version, true); } else { wp_enqueue_script($this->name . '-user-active-script', plugin_dir_url(__FILE__) . 'js/' . wb_get_user_script_name('_active_script'), array('jquery'), $this->version, true); } wp_enqueue_script($this->name . 'woo-bag-public', $wb_plugin_url . '/public/js/woo-bag-public.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name, plugin_dir_url(__FILE__) . 'js/woo-bag-admin.js', array('jquery'), $this->version, true); wp_enqueue_script($this->name . '-woo-bag-admin-show', plugin_dir_url(__FILE__) . 'js/woo-bag-admin-show.js', array('jquery'), $this->version, true); wp_localize_script($this->name, 'wb_admin_ajax_url', array('wb_ajax' => admin_url('admin-ajax.php')), $this->version); }