mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user