From 4073f2b153522aee54d455f1861a51918b5f5b17 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 18 Feb 2009 22:32:42 +0000 Subject: [PATCH] More theme preview tidying. see #8652 git-svn-id: http://svn.automattic.com/wordpress/trunk@10592 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/theme-install.php | 6 +++--- wp-admin/js/theme-preview.dev.js | 4 ++-- wp-admin/js/theme-preview.js | 2 +- wp-admin/themes.php | 6 +++--- wp-includes/script-loader.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index 6833efbbc9..68df268bc9 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -313,14 +313,14 @@ function display_themes($themes, $page = 1, $totalpages = 1) { $preview_link = $theme->preview_url . '?TB_iframe=true&width=600&height=400'; $action_links = array(); $action_links[] = '' . __('Install') . ''; - $action_links[] = '' . __('Preview') . ''; + '&TB_iframe=true&width=600&height=800') . '" class="button thickbox onclick" title="' . attribute_escape(sprintf(__('Install "%s"'), $name)) . '">' . __('Install') . ''; + $action_links[] = '' . __('Preview') . ''; $action_links = apply_filters('theme_install_action_links', $action_links, $theme); $actions = implode ( ' ', $action_links ); echo "
- +

{$name}

diff --git a/wp-admin/js/theme-preview.dev.js b/wp-admin/js/theme-preview.dev.js index 033015694b..7647b4c9c4 100644 --- a/wp-admin/js/theme-preview.dev.js +++ b/wp-admin/js/theme-preview.dev.js @@ -13,8 +13,8 @@ jQuery(document).ready(function($) { tbWindow.css({'top':'30px','margin-top':'0'}); }; - return $('a.thickbox').each( function() { - var href = $(this).attr('href'); + return $('a.thickbox-preview').each( function() { + var href = $(this).parents('.available-theme').find('.previewlink').attr('href'); if ( ! href ) return; href = href.replace(/&width=[0-9]+/g, ''); href = href.replace(/&height=[0-9]+/g, ''); diff --git a/wp-admin/js/theme-preview.js b/wp-admin/js/theme-preview.js index 736a8a14c5..686e47058d 100644 --- a/wp-admin/js/theme-preview.js +++ b/wp-admin/js/theme-preview.js @@ -1 +1 @@ -var thickDims;jQuery(document).ready(function(a){thickDims=function(){var d=a("#TB_window"),c=a(window).height(),b=a(window).width();if(d.size()){d.width(b-90).height(c-60);a("#TB_iframeContent").width(b-90).height(c-90);d.css({"margin-left":"-"+parseInt(((b-90)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){d.css({top:"30px","margin-top":"0"})}}return a("a.thickbox").each(function(){var e=a(this).attr("href");if(!e){return}e=e.replace(/&width=[0-9]+/g,"");e=e.replace(/&height=[0-9]+/g,"");a(this).attr("href",e+"&width="+(b-110)+"&height="+(c-100))})};thickDims().click(function(){var c=a(this).parents(".available-theme").find(".activatelink"),b=c.attr("href"),d=c.html();if(null==d){d=""}a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).append(' '+d+"");a("#TB_iframeContent").width("100%");return false});a(window).resize(function(){thickDims()})});function tb_position(){thickDims()}; \ No newline at end of file +var thickDims;jQuery(document).ready(function(a){thickDims=function(){var d=a("#TB_window"),c=a(window).height(),b=a(window).width();if(d.size()){d.width(b-90).height(c-60);a("#TB_iframeContent").width(b-90).height(c-90);d.css({"margin-left":"-"+parseInt(((b-90)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){d.css({top:"30px","margin-top":"0"})}}return a("a.thickbox-preview").each(function(){var e=a(this).parents(".available-theme").find(".previewlink").attr("href");if(!e){return}e=e.replace(/&width=[0-9]+/g,"");e=e.replace(/&height=[0-9]+/g,"");a(this).attr("href",e+"&width="+(b-110)+"&height="+(c-100))})};thickDims().click(function(){var c=a(this).parents(".available-theme").find(".activatelink"),b=c.attr("href"),d=c.html();if(null==d){d=""}a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).append(' '+d+"");a("#TB_iframeContent").width("100%");return false});a(window).resize(function(){thickDims()})});function tb_position(){thickDims()}; \ No newline at end of file diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 243382b8ef..7448245da2 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -174,16 +174,16 @@ foreach ( $cols as $col => $theme_name ) { $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ) ); $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) ); $tags = $themes[$theme_name]['Tags']; - $thickbox_class = 'thickbox'; + $thickbox_class = 'thickbox thickbox-preview'; $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) ); ?> - + -

+

diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 5f68a8015a..b0c44b95d6 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -341,7 +341,7 @@ function wp_default_scripts( &$scripts ) { 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};' )); - $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090218' ); + $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090219' ); $scripts->add_data( 'theme-preview', 'group', 1 ); $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' );