コード例 #1
0
 /**
  * Register and enqueue admin-specific JavaScript.
  *
  * @return    null    Return early if no settings page is registered.
  * 
  * @since 1.2
  * @version 1.3.9
  * 
  */
 public function enqueue_admin_scripts()
 {
     if (!isset($this->plugin_screen_hook_suffix)) {
         return;
     }
     $screen = get_current_screen();
     if ($this->plugin_screen_hook_suffix == $screen->id) {
         // Load jQuery and jQuery UI
         wp_enqueue_script('jquery');
         wp_enqueue_script('utils');
         wp_enqueue_script('jquery-ui-core');
         wp_enqueue_script('jquery-effects-core');
         wp_enqueue_script('jquery-effects-fade');
         wp_enqueue_script('jquery-ui-sortable');
         wp_enqueue_script('jquery-ui-autocomplete');
         wp_enqueue_script('jquery-ui-position');
         wp_enqueue_script('jquery-ui-widget');
         wp_enqueue_script('jquery-ui-mouse');
         wp_enqueue_script('jquery-ui-draggable');
         wp_enqueue_script('jquery-ui-droppable');
         // Load PostBox
         wp_enqueue_script('postbox');
         if (wp_is_mobile()) {
             wp_enqueue_script('jquery-touch-punch');
         }
         // Load Tag-it script
         wp_deregister_script($this->plugin_slug . '-tag-it-admin-script');
         wp_register_script($this->plugin_slug . '-tag-it-admin-script', Easy_Google_Fonts::get_js_url() . '/tag-it.js', array('jquery'), Easy_Google_Fonts::VERSION);
         wp_enqueue_script($this->plugin_slug . '-tag-it-admin-script');
         // Load admin page js
         wp_deregister_script($this->plugin_slug . '-admin-script');
         wp_register_script($this->plugin_slug . '-admin-script', Easy_Google_Fonts::get_js_url() . '/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-widget'), Easy_Google_Fonts::VERSION);
         wp_enqueue_script($this->plugin_slug . '-admin-script');
         // Load in customizer control javascript object
         wp_localize_script($this->plugin_slug . '-admin-script', 'ttFontl10n', $this->get_l10n());
     }
 }
 /**
  * Load Customizer Live Preview Scripts
  *
  * Loads the required js for the live theme previewer. This
  * is hooked into the live previewer using the action:
  * 'customize_preview_init'. Updates options visually in the
  * live previewer without refreshing the page.
  *  
  * @return void
  *
  * @since  1.3
  * @version 1.3.6
  * 
  */
 public function customize_live_preview_scripts()
 {
     global $wp_customize;
     // Load js for live customizer control
     wp_deregister_script($this->plugin_slug . '-customize-preview-js');
     wp_register_script($this->plugin_slug . '-customize-preview-js', Easy_Google_Fonts::get_js_url() . '/customize-preview.js', array('customize-preview'), Easy_Google_Fonts::VERSION, false);
     wp_enqueue_script($this->plugin_slug . '-customize-preview-js');
     $previewl10n = $this->customize_live_preview_l10n();
     wp_localize_script($this->plugin_slug . '-customize-preview-js', 'egfFontPreviewControls', $previewl10n);
     $all_fonts = $this->customize_load_all_fonts();
     wp_localize_script($this->plugin_slug . '-customize-preview-js', 'egfAllFonts', $all_fonts);
 }
 /**
  * Load Customizer Live Preview Scripts
  *
  * Loads the required js for the live theme previewer. This
  * is hooked into the live previewer using the action:
  * 'customize_preview_init'. Updates options visually in the
  * live previewer without refreshing the page.
  *  
  * @return void
  *
  * @since  1.3
  * @version 1.3.2
  * 
  */
 public function customize_live_preview_scripts()
 {
     global $wp_customize;
     // Load JSON Library by Douglas Crockford
     wp_enqueue_script('json2');
     // Load js for live customizer control
     wp_deregister_script($this->plugin_slug . '-customizer-preview-js');
     wp_register_script($this->plugin_slug . '-customizer-preview-js', Easy_Google_Fonts::get_js_url() . '/customizer-preview.js', false, Easy_Google_Fonts::VERSION, false);
     wp_enqueue_script($this->plugin_slug . '-customizer-preview-js');
     $previewl10n = $this->customize_live_preview_l10n();
     wp_localize_script($this->plugin_slug . '-customizer-preview-js', 'ttFontPreviewControls', $previewl10n);
     $all_fonts = $this->customize_load_all_fonts();
     wp_localize_script($this->plugin_slug . '-customizer-preview-js', 'ttFontAllFonts', $all_fonts);
 }