Make WordPress Core

Ticket #19910: 19910.replace-link.patch

File 19910.replace-link.patch, 4.9 KB (added by ocean90, 13 years ago)
  • wp-includes/js/customize-loader.dev.js

     
    4848                Loader.initialize();
    4949
    5050                // Override 'preview' links on themes page.
    51                 $('.thickbox-preview').click( function( event ) {
    52                         var href, template, stylesheet;
    53 
    54                         // Stop the thickbox.
     51                $('.activate-customizer').click( function( event ) {
    5552                        event.preventDefault();
    56                         event.stopImmediatePropagation();
    5753
    58                         // Extract the template/stylesheet from the preview link's url.
    59                         href = $(this).attr('href');
    60                         template = href.match('template=([^&]*)')[1];
    61                         stylesheet = href.match('stylesheet=([^&]*)')[1];
     54                        // Extract the template/stylesheet from the data attributes.
     55                        template = $(this).data( 'template' );
     56                        stylesheet = $(this).data( 'stylesheet' );
    6257
    6358                        // Load the theme.
    6459                        Loader.open({
    6560                                template: template,
    6661                                stylesheet: stylesheet
    6762                        });
    68                 }).filter( function() {
    69                         return 'Preview' == $(this).text();
    70                 }).text('Customize');
     63                })
    7164        });
    7265
    7366        // Expose the API to the world.
  • wp-includes/script-loader.php

     
    359359
    360360                $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
    361361
    362                 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'thickbox' ), false, 1 );
     362                $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'jquery' ), false, 1 );
    363363
    364364                $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 );
    365365
  • wp-admin/includes/class-wp-themes-list-table.php

     
    1111
    1212        var $search = array();
    1313        var $features = array();
    14        
     14
    1515        function __construct() {
    1616                parent::__construct( array(
    1717                        'ajax' => true,
     
    145145        $parent_theme = $themes[$theme_name]['Parent Theme'];
    146146        $theme_root = $themes[$theme_name]['Theme Root'];
    147147        $theme_root_uri = $themes[$theme_name]['Theme Root URI'];
    148         $preview_link = esc_url( add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), home_url( '/' ) ) );
    149         $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) );
    150148        $tags = $themes[$theme_name]['Tags'];
    151         $thickbox_class = 'thickbox thickbox-preview';
     149        $customize_data = sprintf( 'data-stylesheet="%s" data-template="%s"', esc_attr( $stylesheet ), esc_attr( $template ) );
    152150        $activate_link = wp_nonce_url( "themes.php?action=activate&template=" . urlencode( $template ) . "&stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $template );
    153151        $activate_text = esc_attr( sprintf( __( 'Activate “%s”' ), $title ) );
    154152        $actions = array();
    155153        $actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __( 'Activate' ) . '</a>';
    156         $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $theme_name ) ) . '">' . __( 'Preview' ) . '</a>';
     154        $actions[] = '<a class="activate-customizer hide-if-no-js" href="#" title="' . esc_attr( sprintf( __( 'Customize &#8220;%s&#8221;' ), $theme_name ) ) . '"' . $customize_data . '>' . __( 'Customize' ) . '</a>';
    157155        if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
    158156                $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url( "themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet ) . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete." ), $theme_name ) ) . "' );" . '">' . __( 'Delete' ) . '</a>';
    159157        $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] );
    160158
    161159        $actions = implode ( ' | ', $actions );
    162160?>
    163                 <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
     161                <a href="#" class="screenshot activate-customizer" <?php echo $customize_data; ?>>
    164162<?php if ( $screenshot ) : ?>
    165163                        <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" />
    166164<?php endif; ?>
  • wp-admin/themes.php

     
    6666        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    6767);
    6868
    69 add_thickbox();
    70 wp_enqueue_script( 'theme-preview' );
    7169wp_enqueue_script( 'theme' );
    7270
    7371endif;