@@ 78-96 (lines=19) @@ | ||
75 | * |
|
76 | * @param string $hook Page hook. |
|
77 | */ |
|
78 | public function enqueue_scripts( $hook ) { |
|
79 | if ( strpos( $hook, 'jetpack-debug_page_mocker' ) === 0 ) { |
|
80 | wp_enqueue_style( 'mocker_style', plugin_dir_url( __FILE__ ) . 'inc/css/mocker.css', array(), JETPACK_DEBUG_HELPER_VERSION ); |
|
81 | wp_enqueue_script( 'mocker_script', plugin_dir_url( __FILE__ ) . 'inc/js/mocker.js', array( 'wp-api' ), JETPACK_DEBUG_HELPER_VERSION, true ); |
|
82 | ||
83 | add_filter( |
|
84 | 'script_loader_tag', |
|
85 | function( $tag, $handle ) { |
|
86 | if ( 'mocker_script' === $handle ) { |
|
87 | $tag = str_replace( '<script ', '<script type="module" ', $tag ); |
|
88 | } |
|
89 | ||
90 | return $tag; |
|
91 | }, |
|
92 | 10, |
|
93 | 2 |
|
94 | ); |
|
95 | } |
|
96 | } |
|
97 | ||
98 | /** |
|
99 | * Render UI. |
@@ 43-61 (lines=19) @@ | ||
40 | * |
|
41 | * @param string $hook Page hook. |
|
42 | */ |
|
43 | public function enqueue_scripts( $hook ) { |
|
44 | if ( strpos( $hook, 'jetpack-debug_page_rest-api-tester' ) === 0 ) { |
|
45 | wp_enqueue_style( 'rest_api_tester_style', plugin_dir_url( __FILE__ ) . 'inc/css/rest-api-tester.css', array(), JETPACK_DEBUG_HELPER_VERSION ); |
|
46 | wp_enqueue_script( 'rest_api_tester_script', plugin_dir_url( __FILE__ ) . 'inc/js/rest-api-tester.js', array( 'wp-api' ), JETPACK_DEBUG_HELPER_VERSION, true ); |
|
47 | ||
48 | add_filter( |
|
49 | 'script_loader_tag', |
|
50 | function( $tag, $handle ) { |
|
51 | if ( 'rest_api_tester_script' === $handle ) { |
|
52 | $tag = str_replace( '<script ', '<script type="module" ', $tag ); |
|
53 | } |
|
54 | ||
55 | return $tag; |
|
56 | }, |
|
57 | 10, |
|
58 | 2 |
|
59 | ); |
|
60 | } |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * Render UI. |