diff --git a/wp-admin/js/press-this.js b/wp-admin/js/press-this.js
index e64e882185..27841f756b 100644
--- a/wp-admin/js/press-this.js
+++ b/wp-admin/js/press-this.js
@@ -102,20 +102,18 @@
function getCanonicalLink() {
var link = '';
- if ( data._links ) {
- if ( data._links.canonical && data._links.canonical.length ) {
- link = data._links.canonical;
- }
+ if ( data._links && data._links.canonical ) {
+ link = data._links.canonical;
}
- if ( ! link.length && data.u ) {
+ if ( ! link && data.u ) {
link = data.u;
}
- if ( ! link.length && data._meta ) {
- if ( data._meta['twitter:url'] && data._meta['twitter:url'].length ) {
+ if ( ! link && data._meta ) {
+ if ( data._meta['twitter:url'] ) {
link = data._meta['twitter:url'];
- } else if ( data._meta['og:url'] && data._meta['og:url'].length ) {
+ } else if ( data._meta['og:url'] ) {
link = data._meta['og:url'];
}
}
@@ -132,9 +130,9 @@
var name = '';
if ( data._meta ) {
- if ( data._meta['og:site_name'] && data._meta['og:site_name'].length ) {
+ if ( data._meta['og:site_name'] ) {
name = data._meta['og:site_name'];
- } else if ( data._meta['application-name'] && data._meta['application-name'].length ) {
+ } else if ( data._meta['application-name'] ) {
name = data._meta['application-name'];
}
}
@@ -155,11 +153,11 @@
}
if ( ! title && data._meta ) {
- if ( data._meta['twitter:title'] && data._meta['twitter:title'].length ) {
+ if ( data._meta['twitter:title'] ) {
title = data._meta['twitter:title'];
- } else if ( data._meta['og:title'] && data._meta['og:title'].length ) {
+ } else if ( data._meta['og:title'] ) {
title = data._meta['og:title'];
- } else if ( data._meta.title && data._meta.title.length ) {
+ } else if ( data._meta.title ) {
title = data._meta.title;
}
}
@@ -185,14 +183,14 @@
url = getCanonicalLink(),
siteName = getSourceSiteName();
- if ( data.s && data.s.length ) {
+ if ( data.s ) {
text = data.s;
} else if ( data._meta ) {
- if ( data._meta['twitter:description'] && data._meta['twitter:description'].length ) {
+ if ( data._meta['twitter:description'] ) {
text = data._meta['twitter:description'];
- } else if ( data._meta['og:description'] && data._meta['og:description'].length ) {
+ } else if ( data._meta['og:description'] ) {
text = data._meta['og:description'];
- } else if ( data._meta.description && data._meta.description.length ) {
+ } else if ( data._meta.description ) {
text = data._meta.description;
}
}
@@ -222,7 +220,7 @@
if ( embeds.length ) {
$.each( embeds, function ( i, src ) {
- if ( !src || !src.length ) {
+ if ( ! src ) {
// Skip: no src value
return;
}
@@ -257,7 +255,7 @@
src = src.replace( /http:\/\/[\d]+\.gravatar\.com\//, 'https://secure.gravatar.com/' );
src = checkUrl( src );
- if ( ! src || ! src.length ) {
+ if ( ! src ) {
// Skip: no src value
return;
}
@@ -369,7 +367,7 @@
link = checkUrl( link );
if ( 'img' === type ) {
- if ( ! link || ! link.length ) {
+ if ( ! link ) {
link = src;
}
@@ -480,7 +478,7 @@
*/
function renderStartupNotices() {
// Render errors sent in the data, if any
- if ( data.errors && data.errors.length ) {
+ if ( data.errors ) {
$.each( data.errors, function( i, msg ) {
renderError( msg );
} );
@@ -521,7 +519,7 @@
* Render the suggested content, if any
*/
function renderSuggestedContent() {
- if ( ! suggestedContentStr || ! suggestedContentStr.length ) {
+ if ( ! suggestedContentStr ) {
return;
}
@@ -547,11 +545,11 @@
listContainer.empty();
- if ( ( interestingEmbeds && interestingEmbeds.length ) || ( interestingImages && interestingImages.length ) ) {
+ if ( interestingEmbeds || interestingImages ) {
listContainer.append( '
' + __( 'allMediaHeading' ) + '
' );
}
- if ( interestingEmbeds && interestingEmbeds.length ) {
+ if ( interestingEmbeds ) {
$.each( interestingEmbeds, function ( i, src ) {
src = checkUrl( src );
@@ -580,7 +578,7 @@
'class': cssClass,
'tabindex': '0'
} ).css( {
- 'background-image': ( displaySrc.length ) ? 'url(' + displaySrc + ')' : null
+ 'background-image': ( displaySrc ) ? 'url(' + displaySrc + ')' : null
} ).html(
'' + __( 'suggestedEmbedAlt' ).replace( '%d', i + 1 ) + ''
).on( 'click keypress', function ( e ) {
@@ -593,7 +591,7 @@
} );
}
- if ( interestingImages && interestingImages.length ) {
+ if ( interestingImages ) {
$.each( interestingImages, function ( i, src ) {
src = checkUrl( src );
@@ -748,9 +746,7 @@
} );
$selector.on( 'blur', function() {
- var textLength = $( this ).text().length;
-
- if ( ! textLength ) {
+ if ( ! $( this ).text() ) {
$placeholder.removeClass('is-hidden');
}
} );
@@ -805,7 +801,7 @@
// Needs more work, doesn't detect when the other JS changes the value of #tax-input-post_tag
$( '#tax-input-post_tag' ).on( 'change', function() {
var val = $( this ).val();
- $( '#post-option-tags' ).text( ( val.length ) ? val.replace( /,([^\s])/g, ', $1' ) : '' );
+ $( '#post-option-tags' ).text( ( val ) ? val.replace( /,([^\s])/g, ', $1' ) : '' );
} );
$( window ).on( 'beforeunload.press-this', function() {
diff --git a/wp-admin/js/press-this.min.js b/wp-admin/js/press-this.min.js
index 48f991ba9f..9e7df809aa 100644
--- a/wp-admin/js/press-this.min.js
+++ b/wp-admin/js/press-this.min.js
@@ -1 +1 @@
-!function(a,b){var c=function(){function c(a){return a&&b.pressThisL10n?b.pressThisL10n[a]||a:a||""}function d(a){return a=a||"",a.replace(/|$)/g,"").replace(/<(script|style)[^>]*>[\s\S]*?(<\/\1>|$)/gi,"").replace(/<\/?[a-z][\s\S]*?(>|$)/gi,"")}function e(a){return a=d(a),G.innerHTML=a,d(G.value)}function f(b){return b=a.trim(b||""),/^(?:https?:)?\/\//.test(b)?(b=d(b),b.replace(/["\\]+/g,"")):""}function g(){var a="";return I._links&&I._links.canonical&&I._links.canonical.length&&(a=I._links.canonical),!a.length&&I.u&&(a=I.u),!a.length&&I._meta&&(I._meta["twitter:url"]&&I._meta["twitter:url"].length?a=I._meta["twitter:url"]:I._meta["og:url"]&&I._meta["og:url"].length&&(a=I._meta["og:url"])),f(decodeURI(a))}function h(){var a="";return I._meta&&(I._meta["og:site_name"]&&I._meta["og:site_name"].length?a=I._meta["og:site_name"]:I._meta["application-name"]&&I._meta["application-name"].length&&(a=I._meta["application-name"])),e(a)}function i(){var a="";return I.t&&(a=I.t),!a&&I._meta&&(I._meta["twitter:title"]&&I._meta["twitter:title"].length?a=I._meta["twitter:title"]:I._meta["og:title"]&&I._meta["og:title"].length?a=I._meta["og:title"]:I._meta.title&&I._meta.title.length&&(a=I._meta.title)),a||(a=c("newPost"),M=!0),e(a)}function j(){var a="",b="",d=i(),f=g(),j=h();return I.s&&I.s.length?b=I.s:I._meta&&(I._meta["twitter:description"]&&I._meta["twitter:description"].length?b=I._meta["twitter:description"]:I._meta["og:description"]&&I._meta["og:description"].length?b=I._meta["og:description"]:I._meta.description&&I._meta.description.length&&(b=I._meta.description)),b&&H.html.quote&&(a=H.html.quote.replace(/%1\$s/g,e(b))),f&&H.html.link&&(d&&c("newPost")!==d||j)&&(a+=H.html.link.replace(/%1\$s/g,encodeURI(f)).replace(/%2\$s/g,d||j)),a||""}function k(){var b=I._embed||[],c=[],d=[];return b.length&&a.each(b,function(b,e){if(e&&e.length){var f=e.replace(/^https?:/,"");a.inArray(f,d)>-1||(c.push(e),d.push(f))}}),c}function l(b){var c=b._img||[],d=[],e=[];return c.length&&a.each(c,function(a,b){if(b=b.replace(/http:\/\/[\d]+\.gravatar\.com\//,"https://secure.gravatar.com/"),b=f(b),b&&b.length){var c=b.replace(/^https?:/,"");Array.prototype.indexOf&&e.indexOf(c)>-1||b.indexOf("avatar")>-1&&d.length>=15||(d.push(b),e.push(c))}}),d}function m(){a("#spinner").addClass("show"),a(".post-actions button").each(function(){a(this).attr("disabled","disabled")})}function n(){a("#spinner").removeClass("show"),a(".post-actions button").each(function(){a(this).removeAttr("disabled")})}function o(c){F=!1,m();var d=a("#pressthis-form");"publish"===c&&a("#post_status").val("publish"),E&&E.save(),a("#title-field").val(e(a("#title-container").text())),b.tagBox&&a("div.tagsdiv").each(function(){b.tagBox.flushTags(this,!1,1)});var f=d.serialize();a.ajax({type:"post",url:b.ajaxurl,data:f,success:function(a){if(a.success){if(a.data.redirect)if(b.opener&&H.redirInParent){try{b.opener.location.href=a.data.redirect}catch(c){}b.self.close()}else b.location.href=a.data.redirect}else t(a.data.errorMessage),n()}})}function p(a,b,c){var d="";E&&(b=f(b),c=f(c),"img"===a?(c&&c.length||(c=b),d='
\n'):d="[embed]"+b+"[/embed]\n",P||E.focus(),E.execCommand("mceInsertContent",!1,d),P=!0)}function q(){var c,d=a("#new-category").val();d&&(c={action:"press-this-add-category",post_id:a("#post_ID").val()||0,name:d,new_cat_nonce:a("#_ajax_nonce-add-category").val()||"",parent:a("#new-category-parent").val()||0},a.post(b.ajaxurl,c,function(b){if(b.success){var c,d,e=a("ul.categories-select");a.each(b.data,function(b,f){var g=a("").attr("id","category-"+f.term_id).append(a('