AnsPress_Admin::enqueue_admin_scripts()
Description #
Register and enqueue admin-specific JavaScript.
Source #
File: admin/anspress-admin.php
public static function enqueue_admin_scripts() { wp_register_script( 'anspress-common', ANSPRESS_URL . 'assets/js/common.js', array( 'jquery', 'jquery-form', 'backbone' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_register_script( 'anspress-question', ANSPRESS_URL . 'assets/js/question.js', array( 'anspress-common' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_register_script( 'anspress-ask', ANSPRESS_URL . 'assets/js/ask.js', array( 'anspress-common' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_register_script( 'anspress-list', ANSPRESS_URL . 'assets/js/list.js', array( 'anspress-common' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_register_script( 'anspress-notifiactions', ANSPRESS_URL . 'assets/js/notifications.js', array( 'anspress-common' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_register_script( 'anspress-admin-js', ANSPRESS_URL . 'assets/js/ap-admin.js', array( 'anspress-common' ), AP_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter wp_enqueue_script( 'selectize', ANSPRESS_URL . 'assets/js/lib/selectize.min.js', array( 'jquery' ), AP_VERSION, true ); $page = get_current_screen(); if ( ! ap_load_admin_assets() ) { return; } wp_enqueue_script( 'anspress-question' ); wp_enqueue_script( 'anspress-ask' ); wp_enqueue_script( 'anspress-list' ); wp_enqueue_script( 'anspress-notifiactions' ); wp_enqueue_script( 'anspress-admin-js' ); ?> <script type="text/javascript"> currentQuestionID = '<?php the_ID(); ?>'; apTemplateUrl = '<?php echo esc_url( ap_get_theme_url( 'js-template', false, false ) ); ?>'; aplang = {}; apShowComments = false; removeImage = '<?php esc_attr_e( 'Remove image', 'anspress-question-answer' ); ?>'; </script> <?php if ( 'post' === $page->base && 'question' === $page->post_type ) { wp_enqueue_script( 'ap-admin-app-js', ANSPRESS_URL . 'assets/js/admin-app.js', array(), AP_VERSION, true ); } wp_enqueue_script( 'postbox' ); }
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:108
Add your comment