A little cleanup of post-formats.js
git-svn-id: https://develop.svn.wordpress.org/trunk@24007 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
793f27f07e
commit
2a482cf617
@ -10,7 +10,7 @@ window.wp = window.wp || {};
|
|||||||
container.addClass('wp-format-' + format);
|
container.addClass('wp-format-' + format);
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchFormat ($this) {
|
function switchFormat($this) {
|
||||||
var editor, body,
|
var editor, body,
|
||||||
parent = $this.parent(),
|
parent = $this.parent(),
|
||||||
format = $this.data('wp-format'),
|
format = $this.data('wp-format'),
|
||||||
@ -24,7 +24,6 @@ window.wp = window.wp || {};
|
|||||||
$this.addClass('active');
|
$this.addClass('active');
|
||||||
$('#post_format').val(format);
|
$('#post_format').val(format);
|
||||||
$('.post-format-change').show().find('span.icon').removeClass(postFormats.currentPostFormat).addClass(format);
|
$('.post-format-change').show().find('span.icon').removeClass(postFormats.currentPostFormat).addClass(format);
|
||||||
// container.addClass('wp-format-set');
|
|
||||||
|
|
||||||
if ( -1 < $.inArray( format, noUIFormats ) ) {
|
if ( -1 < $.inArray( format, noUIFormats ) ) {
|
||||||
switchFormatClass( format ); // No slide
|
switchFormatClass( format ); // No slide
|
||||||
@ -62,7 +61,7 @@ window.wp = window.wp || {};
|
|||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
|
|
||||||
$('.post-format-change a').click(function () {
|
$('.post-format-change a').click(function() {
|
||||||
$('.post-formats-fields, .post-format-change').slideUp();
|
$('.post-formats-fields, .post-format-change').slideUp();
|
||||||
$('.post-format-options').slideDown();
|
$('.post-format-options').slideDown();
|
||||||
return false;
|
return false;
|
||||||
@ -75,7 +74,7 @@ window.wp = window.wp || {};
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Media selection
|
// Media selection
|
||||||
$('.wp-format-media-select').click(function (event) {
|
$('.wp-format-media-select').click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var $el = $(this), mime,
|
var $el = $(this), mime,
|
||||||
$holder = $el.closest('.wp-format-media-holder'),
|
$holder = $el.closest('.wp-format-media-holder'),
|
||||||
@ -108,10 +107,8 @@ window.wp = window.wp || {};
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mediaPreview = function (attachment) {
|
mediaPreview = function(attachment) {
|
||||||
var w, h, dimensions = '', url = attachment.url,
|
var w, h, dimensions = '', url = attachment.url, mime = attachment.mime, format = attachment.type;
|
||||||
mime = attachment.mime,
|
|
||||||
format = attachment.type;
|
|
||||||
|
|
||||||
if ( 'video' === format ) {
|
if ( 'video' === format ) {
|
||||||
if ( attachment.width ) {
|
if ( attachment.width ) {
|
||||||
@ -138,7 +135,7 @@ window.wp = window.wp || {};
|
|||||||
};
|
};
|
||||||
|
|
||||||
// When an image is selected, run a callback.
|
// When an image is selected, run a callback.
|
||||||
mediaFrame.on( 'select', function () {
|
mediaFrame.on( 'select', function() {
|
||||||
// Grab the selected attachment.
|
// Grab the selected attachment.
|
||||||
var w = 0, h = 0, html, attachment = mediaFrame.state().get('selection').first().toJSON();
|
var w = 0, h = 0, html, attachment = mediaFrame.state().get('selection').first().toJSON();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user