Wordpress/wp-admin/js/post-formats.min.js
2013-03-16 06:58:41 +00:00

1 line
1.0 KiB
JavaScript

window.wp=window.wp||{};(function(b){var a;b(".post-format-select a").on("click.post-format",function(i){var h=b(this),f,c,g=h.data("wp-format"),d=b("#post-body-content");b(".post-format-select a.nav-tab-active").removeClass("nav-tab-active");h.addClass("nav-tab-active").blur();b("#post_format").val(g);d.get(0).className=d.get(0).className.replace(/\bwp-format-[^ ]+/,"");d.addClass("wp-format-"+g);if(typeof tinymce!="undefined"){f=tinymce.get("content");if(f){c=f.getBody();c.className=c.className.replace(/\bpost-format-[^ ]+/,"");f.dom.addClass(c,"post-format-"+g)}}i.preventDefault()});b("#wp-format-image-select").click(function(e){var c=b(this),f=b("#wp-format-image-holder"),d=b("#wp_format_image");e.preventDefault();if(a){a.open();return}a=wp.media.frames.formatImage=wp.media({title:c.data("choose"),library:{type:"image"},button:{text:c.data("update")}});a.on("select",function(){var h=a.state().get("selection").first(),g=h.get("url");d.attr("value",h.id);c.html('<img src="'+g+'" />');f.removeClass("empty")});a.open()})})(jQuery);