function asg_enqueue_scripts() { switch (get_option('asg_lightbox')) { case 'swipebox': asg_enqueue_script('swipebox', 'vendor/swipebox/jquery.swipebox', array('jquery')); wp_enqueue_style('swipebox', ASG_URL . "vendor/swipebox/swipebox.css", ASG_VERSION); break; case 'prettyphoto': asg_enqueue_script('jquery.prettyphoto', 'vendor/prettyphoto/jquery.prettyPhoto'); break; case 'jetpack': //wp_enqueue_script(''); if (class_exists('Jetpack_Carousel')) { $carousel = new Jetpack_Carousel(); $carousel->enqueue_assets(false); } break; case 'magnific-popup': default: asg_enqueue_script('magnific-popup', 'vendor/jquery.magnific-popup', array('jquery')); wp_enqueue_style('jquery.magnific-popup', ASG_URL . "assets/css/jquery.magnific-popup.css", null, ASG_VERSION); break; } asg_enqueue_script('awesome-gallery', 'assets/js/awesome-gallery', array('jquery')); }
function _admin_enqueue_scripts() { global $post_type, $hook_suffix, $asg_source_editors; if ($post_type != ASG_POST_TYPE || !in_array($hook_suffix, array('post.php', 'post-new.php'))) { return; } wp_enqueue_media(); wp_enqueue_script('jquery-ui'); wp_enqueue_script('rivets', ASG_URL . 'assets/admin/js/rivets.js', array('backbone'), ASG_VERSION); asg_enqueue_scripts(); asg_enqueue_styles(); wp_enqueue_style('asg-gallery-editor', ASG_URL . "assets/admin/css/gallery-editor.css", null, ASG_VERSION); asg_enqueue_script('asg-image-selector', 'assets/admin/js/image-selector'); asg_enqueue_script('asg-gallery-selector', "assets/admin/js/external-gallery-selector", array('media-editor'), ASG_VERSION); asg_enqueue_script('asg-preview', "assets/admin/js/preview", array('media-editor'), ASG_VERSION); asg_enqueue_script('asg-source-editor', "assets/admin/js/source-editor", array('asg-gallery-selector', 'media-editor'), ASG_VERSION); foreach ($asg_source_editors as $slug => $editor) { $source_slug = 'asg-source-' . $slug; asg_enqueue_script($source_slug, $editor->get_js_editor_path(), array('asg-gallery-selector'), ASG_VERSION); $sources[] = $source_slug; } asg_enqueue_script('asg-gallery-editor', 'assets/admin/js/gallery-editor', $sources); wp_localize_script('asg-gallery-editor', 'asgGalleryEditor', array('admin' => true)); }