diff -r 000000000000 -r d970ebf37754 wp/wp-admin/js/theme.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-admin/js/theme.js Wed Nov 06 03:21:17 2013 +0000 @@ -0,0 +1,279 @@ +/** + * Theme Browsing + * + * Controls visibility of theme details on manage and install themes pages. + */ +jQuery( function($) { + $('#availablethemes').on( 'click', '.theme-detail', function (event) { + var theme = $(this).closest('.available-theme'), + details = theme.find('.themedetaildiv'); + + if ( ! details.length ) { + details = theme.find('.install-theme-info .theme-details'); + details = details.clone().addClass('themedetaildiv').appendTo( theme ).hide(); + } + + details.toggle(); + event.preventDefault(); + }); +}); + +/** + * Theme Browser Thickbox + * + * Aligns theme browser thickbox. + */ +var tb_position; +jQuery(document).ready( function($) { + tb_position = function() { + var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 1040 < width ) ? 1040 : width, adminbar_height = 0; + + if ( $('body.admin-bar').length ) + adminbar_height = 28; + + if ( tbWindow.size() ) { + tbWindow.width( W - 50 ).height( H - 45 - adminbar_height ); + $('#TB_iframeContent').width( W - 50 ).height( H - 75 - adminbar_height ); + tbWindow.css({'margin-left': '-' + parseInt( ( ( W - 50 ) / 2 ), 10 ) + 'px'}); + if ( typeof document.body.style.maxWidth != 'undefined' ) + tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'}); + }; + }; + + $(window).resize(function(){ tb_position(); }); +}); + +/** + * Theme Install + * + * Displays theme previews on theme install pages. + */ +jQuery( function($) { + if( ! window.postMessage ) + return; + + var preview = $('#theme-installer'), + info = preview.find('.install-theme-info'), + panel = preview.find('.wp-full-overlay-main'), + body = $( document.body ); + + preview.on( 'click', '.close-full-overlay', function( event ) { + preview.fadeOut( 200, function() { + panel.empty(); + body.removeClass('theme-installer-active full-overlay-active'); + }); + event.preventDefault(); + }); + + preview.on( 'click', '.collapse-sidebar', function( event ) { + preview.toggleClass( 'collapsed' ).toggleClass( 'expanded' ); + event.preventDefault(); + }); + + $('#availablethemes').on( 'click', '.install-theme-preview', function( event ) { + var src; + + info.html( $(this).closest('.installable-theme').find('.install-theme-info').html() ); + src = info.find( '.theme-preview-url' ).val(); + panel.html( '