<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26264] trunk/src/wp-admin/js/inline-edit-post.js: JShint fixes for inline-edit-post.js.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26264">26264</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-11-19 04:31:42 +0000 (Tue, 19 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>JShint fixes for inline-edit-post.js.
props dougwollison.
fixes <a href="http://core.trac.wordpress.org/ticket/26001">#26001</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjsinlineeditpostjs">trunk/src/wp-admin/js/inline-edit-post.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjsinlineeditpostjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/inline-edit-post.js (26263 => 26264)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/inline-edit-post.js 2013-11-19 04:16:50 UTC (rev 26263)
+++ trunk/src/wp-admin/js/inline-edit-post.js 2013-11-19 04:31:42 UTC (rev 26264)
</span><span class="lines">@@ -1,3 +1,6 @@
</span><ins>+/* global inlineEditL10n, ajaxurl, typenow */
+
+var inlineEditPost;
</ins><span class="cx"> (function($) {
</span><span class="cx"> inlineEditPost = {
</span><span class="cx">
</span><span class="lines">@@ -9,12 +12,14 @@
</span><span class="cx">
</span><span class="cx"> // prepare the edit rows
</span><span class="cx"> qeRow.keyup(function(e){
</span><del>- if (e.which == 27)
</del><ins>+ if ( e.which === 27 ) {
</ins><span class="cx"> return inlineEditPost.revert();
</span><ins>+ }
</ins><span class="cx"> });
</span><span class="cx"> bulkRow.keyup(function(e){
</span><del>- if (e.which == 27)
</del><ins>+ if ( e.which === 27 ) {
</ins><span class="cx"> return inlineEditPost.revert();
</span><ins>+ }
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> $('a.cancel', qeRow).click(function(){
</span><span class="lines">@@ -24,8 +29,9 @@
</span><span class="cx"> return inlineEditPost.save(this);
</span><span class="cx"> });
</span><span class="cx"> $('td', qeRow).keydown(function(e){
</span><del>- if ( e.which == 13 )
</del><ins>+ if ( e.which === 13 ) {
</ins><span class="cx"> return inlineEditPost.save(this);
</span><ins>+ }
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> $('a.cancel', bulkRow).click(function(){
</span><span class="lines">@@ -57,7 +63,7 @@
</span><span class="cx">
</span><span class="cx"> $('#doaction, #doaction2').click(function(e){
</span><span class="cx"> var n = $(this).attr('id').substr(2);
</span><del>- if ( $('select[name="'+n+'"]').val() == 'edit' ) {
</del><ins>+ if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
</ins><span class="cx"> e.preventDefault();
</span><span class="cx"> t.setBulk();
</span><span class="cx"> } else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
</span><span class="lines">@@ -68,7 +74,7 @@
</span><span class="cx">
</span><span class="cx"> toggle : function(el){
</span><span class="cx"> var t = this;
</span><del>- $(t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);
</del><ins>+ $( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el );
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> setBulk : function(){
</span><span class="lines">@@ -79,7 +85,7 @@
</span><span class="cx"> $('table.widefat tbody').prepend( $('#bulk-edit') );
</span><span class="cx"> $('#bulk-edit').addClass('inline-editor').show();
</span><span class="cx">
</span><del>- $('tbody th.check-column input[type="checkbox"]').each(function(i){
</del><ins>+ $( 'tbody th.check-column input[type="checkbox"]' ).each( function() {
</ins><span class="cx"> if ( $(this).prop('checked') ) {
</span><span class="cx"> c = false;
</span><span class="cx"> var id = $(this).val(), theTitle;
</span><span class="lines">@@ -88,8 +94,9 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- if ( c )
</del><ins>+ if ( c ) {
</ins><span class="cx"> return this.revert();
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> $('#bulk-titles').html(te);
</span><span class="cx"> $('#bulk-titles a').click(function(){
</span><span class="lines">@@ -100,7 +107,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // enable autocomplete for tags
</span><del>- if ( 'post' == type ) {
</del><ins>+ if ( 'post' === type ) {
</ins><span class="cx"> // support multi taxonomies?
</span><span class="cx"> tax = 'post_tag';
</span><span class="cx"> $('tr.inline-editor textarea[name="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma + ' ' } );
</span><span class="lines">@@ -112,19 +119,22 @@
</span><span class="cx"> var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f;
</span><span class="cx"> t.revert();
</span><span class="cx">
</span><del>- if ( typeof(id) == 'object' )
</del><ins>+ if ( typeof(id) === 'object' ) {
</ins><span class="cx"> id = t.getId(id);
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order'];
</span><del>- if ( t.type == 'page' )
</del><ins>+ if ( t.type === 'page' ) {
</ins><span class="cx"> fields.push('post_parent', 'page_template');
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // add the new blank row
</span><span class="cx"> editRow = $('#inline-edit').clone(true);
</span><span class="cx"> $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length);
</span><span class="cx">
</span><del>- if ( $(t.what+id).hasClass('alternate') )
</del><ins>+ if ( $( t.what + id ).hasClass( 'alternate' ) ) {
</ins><span class="cx"> $(editRow).addClass('alternate');
</span><ins>+ }
</ins><span class="cx"> $(t.what+id).hide().after(editRow);
</span><span class="cx">
</span><span class="cx"> // populate the data
</span><span class="lines">@@ -133,7 +143,7 @@
</span><span class="cx"> // author no longer has edit caps, so we need to add them to the list of authors
</span><span class="cx"> $(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>');
</span><span class="cx"> }
</span><del>- if ( $(':input[name="post_author"] option', editRow).length == 1 ) {
</del><ins>+ if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
</ins><span class="cx"> $('label.inline-edit-author', editRow).hide();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -141,24 +151,29 @@
</span><span class="cx"> cur_format = $('.post_format', rowData).text();
</span><span class="cx"> $('option.unsupported', editRow).each(function() {
</span><span class="cx"> var $this = $(this);
</span><del>- if ( $this.val() != cur_format )
</del><ins>+ if ( $this.val() !== cur_format ) {
</ins><span class="cx"> $this.remove();
</span><ins>+ }
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> for ( f = 0; f < fields.length; f++ ) {
</span><span class="cx"> $(':input[name="' + fields[f] + '"]', editRow).val( $('.'+fields[f], rowData).text() );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( $('.comment_status', rowData).text() == 'open' )
- $('input[name="comment_status"]', editRow).prop("checked", true);
- if ( $('.ping_status', rowData).text() == 'open' )
- $('input[name="ping_status"]', editRow).prop("checked", true);
- if ( $('.sticky', rowData).text() == 'sticky' )
- $('input[name="sticky"]', editRow).prop("checked", true);
</del><ins>+ if ( $( '.comment_status', rowData ).text() === 'open' ) {
+ $( 'input[name="comment_status"]', editRow ).prop( 'checked', true );
+ }
+ if ( $( '.ping_status', rowData ).text() === 'open' ) {
+ $( 'input[name="ping_status"]', editRow ).prop( 'checked', true );
+ }
+ if ( $( '.sticky', rowData ).text() === 'sticky' ) {
+ $( 'input[name="sticky"]', editRow ).prop( 'checked', true );
+ }
</ins><span class="cx">
</span><span class="cx"> // hierarchical taxonomies
</span><span class="cx"> $('.post_category', rowData).each(function(){
</span><del>- var term_ids = $(this).text();
</del><ins>+ var taxname,
+ term_ids = $(this).text();
</ins><span class="cx">
</span><span class="cx"> if ( term_ids ) {
</span><span class="cx"> taxname = $(this).attr('id').replace('_'+id, '');
</span><span class="lines">@@ -174,8 +189,9 @@
</span><span class="cx"> comma = inlineEditL10n.comma;
</span><span class="cx">
</span><span class="cx"> if ( terms ) {
</span><del>- if ( ',' !== comma )
</del><ins>+ if ( ',' !== comma ) {
</ins><span class="cx"> terms = terms.replace(/,/g, comma);
</span><ins>+ }
</ins><span class="cx"> textarea.val(terms);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -184,11 +200,12 @@
</span><span class="cx">
</span><span class="cx"> // handle the post status
</span><span class="cx"> status = $('._status', rowData).text();
</span><del>- if ( 'future' != status )
</del><ins>+ if ( 'future' !== status ) {
</ins><span class="cx"> $('select[name="_status"] option[value="future"]', editRow).remove();
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( 'private' == status ) {
- $('input[name="keep_private"]', editRow).prop("checked", true);
</del><ins>+ if ( 'private' === status ) {
+ $('input[name="keep_private"]', editRow).prop('checked', true);
</ins><span class="cx"> $('input.inline-edit-password-input').val('').prop('disabled', true);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -199,8 +216,12 @@
</span><span class="cx"> nextPage = pageOpt;
</span><span class="cx"> while ( pageLoop ) {
</span><span class="cx"> nextPage = nextPage.next('option');
</span><del>- if (nextPage.length == 0) break;
</del><ins>+ if ( nextPage.length === 0 ) {
+ break;
+ }
+
</ins><span class="cx"> nextLevel = nextPage[0].className.split('-')[1];
</span><ins>+
</ins><span class="cx"> if ( nextLevel <= pageLevel ) {
</span><span class="cx"> pageLoop = false;
</span><span class="cx"> } else {
</span><span class="lines">@@ -220,8 +241,9 @@
</span><span class="cx"> save : function(id) {
</span><span class="cx"> var params, fields, page = $('.post_status_page').val() || '';
</span><span class="cx">
</span><del>- if ( typeof(id) == 'object' )
</del><ins>+ if ( typeof(id) === 'object' ) {
</ins><span class="cx"> id = this.getId(id);
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> $('table.widefat .spinner').show();
</span><span class="cx">
</span><span class="lines">@@ -242,7 +264,7 @@
</span><span class="cx"> $('table.widefat .spinner').hide();
</span><span class="cx">
</span><span class="cx"> if (r) {
</span><del>- if ( -1 != r.indexOf('<tr') ) {
</del><ins>+ if ( -1 !== r.indexOf( '<tr' ) ) {
</ins><span class="cx"> $(inlineEditPost.what+id).remove();
</span><span class="cx"> $('#edit-'+id).before(r).remove();
</span><span class="cx"> $(inlineEditPost.what+id).hide().fadeIn();
</span><span class="lines">@@ -257,8 +279,8 @@
</span><span class="cx"> if ( $('#post-'+id).prev().hasClass('alternate') ) {
</span><span class="cx"> $('#post-'+id).removeClass('alternate');
</span><span class="cx"> }
</span><del>- }
- , 'html');
</del><ins>+ },
+ 'html');
</ins><span class="cx"> return false;
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -268,7 +290,7 @@
</span><span class="cx"> if ( id ) {
</span><span class="cx"> $('table.widefat .spinner').hide();
</span><span class="cx">
</span><del>- if ( 'bulk-edit' == id ) {
</del><ins>+ if ( 'bulk-edit' === id ) {
</ins><span class="cx"> $('table.widefat #bulk-edit').removeClass('inline-editor').hide();
</span><span class="cx"> $('#bulk-titles').html('');
</span><span class="cx"> $('#inlineedit').append( $('#bulk-edit') );
</span><span class="lines">@@ -319,12 +341,14 @@
</span><span class="cx"> var check = [];
</span><span class="cx">
</span><span class="cx"> $('#the-list tr').each( function(i, el) {
</span><del>- if ( el.id )
</del><ins>+ if ( el.id ) {
</ins><span class="cx"> check.push( el.id );
</span><ins>+ }
</ins><span class="cx"> });
</span><span class="cx">
</span><del>- if ( check.length )
</del><ins>+ if ( check.length ) {
</ins><span class="cx"> data['wp-check-locked-posts'] = check;
</span><ins>+ }
</ins><span class="cx"> }).ready( function() {
</span><span class="cx"> // Set the heartbeat interval to 15 sec.
</span><span class="cx"> if ( typeof wp !== 'undefined' && wp.heartbeat ) {
</span></span></pre>
</div>
</div>
</body>
</html>