2013-02-18 14:11:24 -05:00
|
|
|
(function($){
|
|
|
|
|
|
|
|
// Post formats selection
|
2013-03-16 01:57:54 -04:00
|
|
|
$('.post-format-select a').on( 'click.post-format', function(e) {
|
2013-03-19 13:18:07 -04:00
|
|
|
var $this = $(this),
|
|
|
|
editor,
|
|
|
|
body,
|
|
|
|
format = $this.data('wp-format'),
|
|
|
|
container = $('#post-body-content');
|
2013-03-16 01:57:54 -04:00
|
|
|
|
2013-02-18 14:11:24 -05:00
|
|
|
$('.post-format-select a.nav-tab-active').removeClass('nav-tab-active');
|
|
|
|
$this.addClass('nav-tab-active').blur();
|
|
|
|
$('#post_format').val(format);
|
2013-03-16 01:57:54 -04:00
|
|
|
|
|
|
|
container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
|
|
|
|
container.addClass('wp-format-' + format);
|
|
|
|
|
|
|
|
if ( typeof tinymce != 'undefined' ) {
|
|
|
|
editor = tinymce.get('content');
|
|
|
|
|
|
|
|
if ( editor ) {
|
|
|
|
body = editor.getBody();
|
|
|
|
body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
|
|
|
|
editor.dom.addClass( body, 'post-format-' + format );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e.preventDefault();
|
2013-02-18 14:11:24 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|