Make WordPress Core

Ticket #41143: 41143_4.diff

File 41143_4.diff, 3.4 KB (added by xkon, 9 years ago)

Intergration with theme-plugin-editor.js

  • src/wp-admin/js/theme-plugin-editor.js

     
    7373                        }
    7474                        return undefined;
    7575                } );
     76
     77                /**
     78                 * Activates / Deactivates Documentation Lookup Button
     79                 *
     80                 * @since 5.0.0
     81                 * @type {*|HTMLElement}
     82                 */
     83
     84                var docsList = $('#docs-list');
     85                var docsListButton = $('#docs-list-button');
     86
     87                docsList.on( 'change', function() {
     88                        if ( '' !== $( this ).val() ) {
     89                                docsListButton.prop('disabled', false);
     90                        } else {
     91                                docsListButton.prop('disabled', true);
     92                        }
     93                } );
    7694        };
    7795
    7896        /**
  • src/wp-admin/plugin-editor.php

     
    265265                        <input type="hidden" name="plugin" value="<?php echo esc_attr( $plugin ); ?>" />
    266266                </div>
    267267                <?php if ( ! empty( $docs_select ) ) : ?>
    268                 <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e( 'Documentation:' ); ?></label> <?php echo $docs_select; ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" /></div>
     268                <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e( 'Documentation:' ); ?></label> <?php echo $docs_select; ?> <input disabled type="button" id="docs-list-button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" /></div>
    269269                <?php endif; ?>
    270270<?php if ( is_writeable( $real_file ) ) : ?>
    271271        <div class="editor-notices">
  • src/wp-admin/theme-editor.php

     
    285285                <div id="documentation" class="hide-if-no-js">
    286286                <label for="docs-list"><?php _e( 'Documentation:' ); ?></label>
    287287                <?php echo $docs_select; ?>
    288                 <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" />
     288                <input disabled type="button" id="docs-list-button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" />
    289289                </div>
    290290        <?php endif; ?>
    291291