Changeset 26264
- Timestamp:
- 11/19/2013 04:31:42 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/js/inline-edit-post.js (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/inline-edit-post.js
r26169 r26264 1 /* global inlineEditL10n, ajaxurl, typenow */ 2 3 var inlineEditPost; 1 4 (function($) { 2 5 inlineEditPost = { … … 10 13 // prepare the edit rows 11 14 qeRow.keyup(function(e){ 12 if ( e.which == 27)15 if ( e.which === 27 ) { 13 16 return inlineEditPost.revert(); 17 } 14 18 }); 15 19 bulkRow.keyup(function(e){ 16 if ( e.which == 27)20 if ( e.which === 27 ) { 17 21 return inlineEditPost.revert(); 22 } 18 23 }); 19 24 … … 25 30 }); 26 31 $('td', qeRow).keydown(function(e){ 27 if ( e.which == 13 )32 if ( e.which === 13 ) { 28 33 return inlineEditPost.save(this); 34 } 29 35 }); 30 36 … … 58 64 $('#doaction, #doaction2').click(function(e){ 59 65 var n = $(this).attr('id').substr(2); 60 if ( $('select[name="'+n+'"]').val() == 'edit') {66 if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) { 61 67 e.preventDefault(); 62 68 t.setBulk(); … … 69 75 toggle : function(el){ 70 76 var t = this; 71 $( t.what+t.getId(el)).css('display') == 'none' ? t.revert() : t.edit(el);77 $( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el ); 72 78 }, 73 79 … … 80 86 $('#bulk-edit').addClass('inline-editor').show(); 81 87 82 $( 'tbody th.check-column input[type="checkbox"]').each(function(i){88 $( 'tbody th.check-column input[type="checkbox"]' ).each( function() { 83 89 if ( $(this).prop('checked') ) { 84 90 c = false; … … 89 95 }); 90 96 91 if ( c ) 97 if ( c ) { 92 98 return this.revert(); 99 } 93 100 94 101 $('#bulk-titles').html(te); … … 101 108 102 109 // enable autocomplete for tags 103 if ( 'post' == type ) {110 if ( 'post' === type ) { 104 111 // support multi taxonomies? 105 112 tax = 'post_tag'; … … 113 120 t.revert(); 114 121 115 if ( typeof(id) == 'object' )122 if ( typeof(id) === 'object' ) { 116 123 id = t.getId(id); 124 } 117 125 118 126 fields = ['post_title', 'post_name', 'post_author', '_status', 'jj', 'mm', 'aa', 'hh', 'mn', 'ss', 'post_password', 'post_format', 'menu_order']; 119 if ( t.type == 'page' )127 if ( t.type === 'page' ) { 120 128 fields.push('post_parent', 'page_template'); 129 } 121 130 122 131 // add the new blank row … … 124 133 $('td', editRow).attr('colspan', $('.widefat:first thead th:visible').length); 125 134 126 if ( $( t.what+id).hasClass('alternate') )135 if ( $( t.what + id ).hasClass( 'alternate' ) ) { 127 136 $(editRow).addClass('alternate'); 137 } 128 138 $(t.what+id).hide().after(editRow); 129 139 … … 134 144 $(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>'); 135 145 } 136 if ( $( ':input[name="post_author"] option', editRow).length== 1 ) {146 if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) { 137 147 $('label.inline-edit-author', editRow).hide(); 138 148 } … … 142 152 $('option.unsupported', editRow).each(function() { 143 153 var $this = $(this); 144 if ( $this.val() != cur_format )154 if ( $this.val() !== cur_format ) { 145 155 $this.remove(); 156 } 146 157 }); 147 158 … … 150 161 } 151 162 152 if ( $('.comment_status', rowData).text() == 'open' ) 153 $('input[name="comment_status"]', editRow).prop("checked", true); 154 if ( $('.ping_status', rowData).text() == 'open' ) 155 $('input[name="ping_status"]', editRow).prop("checked", true); 156 if ( $('.sticky', rowData).text() == 'sticky' ) 157 $('input[name="sticky"]', editRow).prop("checked", true); 163 if ( $( '.comment_status', rowData ).text() === 'open' ) { 164 $( 'input[name="comment_status"]', editRow ).prop( 'checked', true ); 165 } 166 if ( $( '.ping_status', rowData ).text() === 'open' ) { 167 $( 'input[name="ping_status"]', editRow ).prop( 'checked', true ); 168 } 169 if ( $( '.sticky', rowData ).text() === 'sticky' ) { 170 $( 'input[name="sticky"]', editRow ).prop( 'checked', true ); 171 } 158 172 159 173 // hierarchical taxonomies 160 174 $('.post_category', rowData).each(function(){ 161 var term_ids = $(this).text(); 175 var taxname, 176 term_ids = $(this).text(); 162 177 163 178 if ( term_ids ) { … … 175 190 176 191 if ( terms ) { 177 if ( ',' !== comma ) 192 if ( ',' !== comma ) { 178 193 terms = terms.replace(/,/g, comma); 194 } 179 195 textarea.val(terms); 180 196 } … … 185 201 // handle the post status 186 202 status = $('._status', rowData).text(); 187 if ( 'future' != status )203 if ( 'future' !== status ) { 188 204 $('select[name="_status"] option[value="future"]', editRow).remove(); 189 190 if ( 'private' == status ) { 191 $('input[name="keep_private"]', editRow).prop("checked", true); 205 } 206 207 if ( 'private' === status ) { 208 $('input[name="keep_private"]', editRow).prop('checked', true); 192 209 $('input.inline-edit-password-input').val('').prop('disabled', true); 193 210 } … … 200 217 while ( pageLoop ) { 201 218 nextPage = nextPage.next('option'); 202 if (nextPage.length == 0) break; 219 if ( nextPage.length === 0 ) { 220 break; 221 } 222 203 223 nextLevel = nextPage[0].className.split('-')[1]; 224 204 225 if ( nextLevel <= pageLevel ) { 205 226 pageLoop = false; … … 221 242 var params, fields, page = $('.post_status_page').val() || ''; 222 243 223 if ( typeof(id) == 'object' )244 if ( typeof(id) === 'object' ) { 224 245 id = this.getId(id); 246 } 225 247 226 248 $('table.widefat .spinner').show(); … … 243 265 244 266 if (r) { 245 if ( -1 != r.indexOf('<tr') ) {267 if ( -1 !== r.indexOf( '<tr' ) ) { 246 268 $(inlineEditPost.what+id).remove(); 247 269 $('#edit-'+id).before(r).remove(); … … 258 280 $('#post-'+id).removeClass('alternate'); 259 281 } 260 } 261 ,'html');282 }, 283 'html'); 262 284 return false; 263 285 }, … … 269 291 $('table.widefat .spinner').hide(); 270 292 271 if ( 'bulk-edit' == id ) {293 if ( 'bulk-edit' === id ) { 272 294 $('table.widefat #bulk-edit').removeClass('inline-editor').hide(); 273 295 $('#bulk-titles').html(''); … … 320 342 321 343 $('#the-list tr').each( function(i, el) { 322 if ( el.id ) 344 if ( el.id ) { 323 345 check.push( el.id ); 346 } 324 347 }); 325 348 326 if ( check.length ) 349 if ( check.length ) { 327 350 data['wp-check-locked-posts'] = check; 351 } 328 352 }).ready( function() { 329 353 // Set the heartbeat interval to 15 sec.
Note: See TracChangeset
for help on using the changeset viewer.