Theme Customizer: Improve the customize loader and themes list table markup. see #19910.

* Use event delegation for triggering the customize loader (so we play nicely with infinite scroll).
* Use data attributes on .load-customize links instead of parsing the href.
* Properly translate the 'Customize' string instead of injecting the replacement with JS.

git-svn-id: https://develop.svn.wordpress.org/trunk@20352 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith
2012-04-04 21:02:29 +00:00
parent dfab3319f8
commit 31caea7b9b
2 changed files with 12 additions and 18 deletions

View File

@@ -41,27 +41,17 @@ if ( typeof wp === 'undefined' )
$( function() {
Loader.initialize();
// Override 'preview' links on themes page.
$('.thickbox-preview').click( function( event ) {
var href, template, stylesheet;
$('#current-theme, #availablethemes').on( 'click', '.load-customize', function( event ) {
var load = $(this);
// Stop the thickbox.
event.preventDefault();
event.stopImmediatePropagation();
// Extract the template/stylesheet from the preview link's url.
href = $(this).attr('href');
template = href.match('template=([^&]*)')[1];
stylesheet = href.match('stylesheet=([^&]*)')[1];
// Load the theme.
Loader.open({
template: template,
stylesheet: stylesheet
template: load.data('customizeTemplate'),
stylesheet: load.data('customizeStylesheet')
});
}).filter( function() {
return 'Preview' == $(this).text();
}).text('Customize');
});
});
// Expose the API to the world.