WordPress/wp-admin/js/post-formats.min.js
Bot (Assets) 2840f02efc Compress scripts/styles: 3.6-alpha-23846.
git-svn-id: http://core.svn.wordpress.org/trunk@23846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-29 04:58:39 +00:00

1 line
2.0 KiB
JavaScript

window.wp=window.wp||{};(function(d){var b,a,e,c;d(".post-format-options a").on("click",function(m){var l=d(this),i,f,h=l.parent(),k=l.data("wp-format"),g=d("#post-body-content"),j=d(".post-format-description");h.find("a.active").removeClass("active");l.addClass("active");d("#icon-edit").removeClass(postFormats.currentPostFormat).addClass(k);d("#post_format").val(k);g.get(0).className=g.get(0).className.replace(/\bwp-format-[^ ]+/,"");g.addClass("wp-format-"+k);d("#title").focus();j.html(l.data("description"));if(j.not(":visible")){j.slideDown("fast")}if(typeof tinymce!="undefined"){i=tinymce.get("content");if(i){f=i.getBody();f.className=f.className.replace(/\bpost-format-[^ ]+/,"");i.dom.addClass(f,"post-format-"+k)}}postFormats.currentPostFormat=k;m.preventDefault()}).on("mouseenter focusin",function(){d(".post-format-tip").html(d(this).prop("title"))}).on("mouseleave focusout",function(){d(".post-format-tip").html(d(".post-format-options a.active").prop("title"))});d(".wp-format-media-select").click(function(h){h.preventDefault();var f=d(this),j,g,i="image",k="",j=f.closest(".wp-format-media-holder"),g=d("#wp_format_"+j.data("format"));switch(j.data("format")){case"audio":i="audio";break;case"video":i="video";break}if(b&&a===i&&e===k){b.open();return}a=i;e=k;b=wp.media.frames.formatMedia=wp.media({title:f.data("choose"),toolbar:k,library:{type:i},button:{text:f.data("update")}});c=function(n,l,m){d("#"+n+"-preview").remove();j.parent().prepend('<div id="'+n+'-preview" class="wp-format-media-preview"><'+n+' class="wp-'+n+'-shortcode" controls="controls" preload="none"><source type="'+m+'" src="'+l+'" /></'+n+"></div>");d(".wp-"+n+"-shortcode").mediaelementplayer()};b.on("select",function(){var n=b.state().get("selection").first(),m,l,o;o=n.get("id");l=n.get("url");m=n.get("mime");if(0===m.indexOf("audio")){g.val(l);c("audio",l,m)}else{if(0===m.indexOf("video")){g.val(l);c("video",l,m)}else{g.val(l);f.html('<img src="'+l+'" />');j.removeClass("empty").show()}}});b.open()})})(jQuery);