@@ 6-39 (lines=34) @@ | ||
3 | /** |
|
4 | * WordPress Shortcode Editor View JS Code |
|
5 | */ |
|
6 | function videopress_handle_editor_view_js() { |
|
7 | global $content_width; |
|
8 | $current_screen = get_current_screen(); |
|
9 | if ( ! isset( $current_screen->id ) || $current_screen->base !== 'post' ) { |
|
10 | return; |
|
11 | } |
|
12 | ||
13 | add_action( 'admin_print_footer_scripts', 'videopress_editor_view_js_templates' ); |
|
14 | ||
15 | wp_enqueue_style( 'videopress-editor-ui', plugins_url( 'css/editor.css', __FILE__ ) ); |
|
16 | wp_enqueue_script( 'videopress-editor-view', plugins_url( 'js/editor-view.js', __FILE__ ), array( 'wp-util', 'jquery' ), false, true ); |
|
17 | wp_localize_script( 'videopress-editor-view', 'vpEditorView', array( |
|
18 | 'home_url_host' => parse_url( home_url(), PHP_URL_HOST ), |
|
19 | 'min_content_width' => VIDEOPRESS_MIN_WIDTH, |
|
20 | 'content_width' => $content_width, |
|
21 | 'modal_labels' => array( |
|
22 | 'title' => esc_html__( 'VideoPress Shortcode', 'jetpack' ), |
|
23 | 'guid' => esc_html__( 'Video ID', 'jetpack' ), |
|
24 | 'w' => esc_html__( 'Video Width', 'jetpack' ), |
|
25 | 'w_unit' => esc_html__( 'pixels', 'jetpack' ), |
|
26 | /* Translators: example of usage of this is "Start Video After 10 seconds" */ |
|
27 | 'at' => esc_html__( 'Start Video After', 'jetpack' ), |
|
28 | 'at_unit' => esc_html__( 'seconds', 'jetpack' ), |
|
29 | 'hd' => esc_html__( 'High definition on by default', 'jetpack' ), |
|
30 | 'permalink' => esc_html__( 'Link the video title to its URL on VideoPress.com', 'jetpack' ), |
|
31 | 'autoplay' => esc_html__( 'Autoplay video on page load', 'jetpack' ), |
|
32 | 'loop' => esc_html__( 'Loop video playback', 'jetpack' ), |
|
33 | 'freedom' => esc_html__( 'Use only Open Source codecs (may degrade performance)', 'jetpack' ), |
|
34 | 'flashonly' => esc_html__( 'Use legacy Flash Player (not recommended)', 'jetpack' ), |
|
35 | ) |
|
36 | ) ); |
|
37 | ||
38 | add_editor_style( plugins_url( 'css/videopress-editor-style.css', __FILE__ ) ); |
|
39 | } |
|
40 | add_action( 'admin_notices', 'videopress_handle_editor_view_js' ); |
|
41 | ||
42 | /** |
@@ 6-39 (lines=34) @@ | ||
3 | /** |
|
4 | * WordPress Shortcode Editor View JS Code |
|
5 | */ |
|
6 | function videopress_handle_editor_view_js() { |
|
7 | global $content_width; |
|
8 | $current_screen = get_current_screen(); |
|
9 | if ( ! isset( $current_screen->id ) || $current_screen->base !== 'post' ) { |
|
10 | return; |
|
11 | } |
|
12 | ||
13 | add_action( 'admin_print_footer_scripts', 'videopress_editor_view_js_templates' ); |
|
14 | ||
15 | wp_enqueue_style( 'videopress-editor-ui', plugins_url( 'css/editor.css', __FILE__ ) ); |
|
16 | wp_enqueue_script( 'videopress-editor-view', plugins_url( 'js/editor-view.js', __FILE__ ), array( 'wp-util', 'jquery' ), false, true ); |
|
17 | wp_localize_script( 'videopress-editor-view', 'vpEditorView', array( |
|
18 | 'home_url_host' => parse_url( home_url(), PHP_URL_HOST ), |
|
19 | 'min_content_width' => VIDEOPRESS_MIN_WIDTH, |
|
20 | 'content_width' => $content_width, |
|
21 | 'modal_labels' => array( |
|
22 | 'title' => esc_html__( 'VideoPress Shortcode', 'jetpack' ), |
|
23 | 'guid' => esc_html__( 'Video ID', 'jetpack' ), |
|
24 | 'w' => esc_html__( 'Video Width', 'jetpack' ), |
|
25 | 'w_unit' => esc_html__( 'pixels', 'jetpack' ), |
|
26 | /* Translators: example of usage of this is "Start Video After 10 seconds" */ |
|
27 | 'at' => esc_html__( 'Start Video After', 'jetpack' ), |
|
28 | 'at_unit' => esc_html__( 'seconds', 'jetpack' ), |
|
29 | 'hd' => esc_html__( 'High definition on by default', 'jetpack' ), |
|
30 | 'permalink' => esc_html__( 'Link the video title to its URL on VideoPress.com', 'jetpack' ), |
|
31 | 'autoplay' => esc_html__( 'Autoplay video on page load', 'jetpack' ), |
|
32 | 'loop' => esc_html__( 'Loop video playback', 'jetpack' ), |
|
33 | 'freedom' => esc_html__( 'Use only Open Source codecs (may degrade performance)', 'jetpack' ), |
|
34 | 'flashonly' => esc_html__( 'Use legacy Flash Player (not recommended)', 'jetpack' ), |
|
35 | ) |
|
36 | ) ); |
|
37 | ||
38 | add_editor_style( plugins_url( 'css/videopress-editor-style.css', __FILE__ ) ); |
|
39 | } |
|
40 | add_action( 'admin_notices', 'videopress_handle_editor_view_js' ); |
|
41 | ||
42 | /** |