Changeset 26204
- Timestamp:
- 11/15/2013 05:34:14 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/js/post.js (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/post.js
r26169 r26204 1 /* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, getUserSetting, setUserSetting */ 2 /* global theList:true, theExtraList:true, autosave:true */ 3 1 4 var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint; 2 5 … … 82 85 83 86 flushTags : function(el, a, f) { 87 var tagsval, newtags, text, 88 tags = $('.the-tags', el), 89 newtag = $('input.newtag', el), 90 comma = postL10n.comma; 84 91 a = a || false; 85 var tags = $('.the-tags', el),86 newtag = $('input.newtag', el),87 comma = postL10n.comma,88 newtags, text;89 92 90 93 text = a ? $(a).text() : newtag.val(); … … 109 112 110 113 $.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) { 111 if ( 0 == r || 'success' != stat )114 if ( 0 === r || 'success' != stat ) 112 115 r = wpAjax.broken; 113 116 … … 138 141 139 142 $('input.newtag', ajaxtag).blur(function() { 140 if ( this.value == '')143 if ( '' === this.value ) 141 144 $(this).parent().siblings('.taghint').css('visibility', ''); 142 145 }).focus(function(){ … … 207 210 208 211 theList = theExtraList = null; 209 $( "a[className*=':']").unbind();212 $( 'a[className*=\':\']' ).unbind(); 210 213 211 214 if ( commentsBox.st > commentsBox.total ) … … 241 244 WPRemoveThumbnail = function(nonce){ 242 245 $.post(ajaxurl, { 243 action: "set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)246 action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie ) 244 247 }, function(str){ 245 248 if ( str == '0' ) { … … 260 263 return; 261 264 262 send ['post_id']= post_id;265 send.post_id = post_id; 263 266 264 267 if ( lock ) 265 send ['lock']= lock;268 send.lock = lock; 266 269 267 270 data['wp-refresh-post-lock'] = send; … … 352 355 353 356 jQuery(document).ready( function($) { 354 var stamp, visibility, sticky = '', last = 0, co = $('#content'); 357 var stamp, visibility, updateVisibility, updateText, 358 sticky = '', last = 0, co = $('#content'); 355 359 356 360 postboxes.add_postbox_toggles(pagenow); … … 407 411 $(t).show(); 408 412 if ( '#' + taxonomy + '-all' == t ) 409 deleteUserSetting( settingName);413 deleteUserSetting( settingName ); 410 414 else 411 setUserSetting( settingName, 'pop');412 return false; 413 }); 414 415 if ( getUserSetting( settingName) )415 setUserSetting( settingName, 'pop' ); 416 return false; 417 }); 418 419 if ( getUserSetting( settingName ) ) 416 420 $('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click(); 417 421 418 422 // Ajax Cat 419 $( '#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' )} );423 $( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } ); 420 424 421 425 $('#new' + taxonomy).keypress( function(event){ … … 469 473 // Custom Fields 470 474 if ( $('#postcustom').length ) { 471 $( '#the-list').wpList( { addAfter: function( xml, s) {475 $( '#the-list' ).wpList( { addAfter: function() { 472 476 $('table#list-table').show(); 473 477 }, addBefore: function( s ) { … … 483 487 visibility = $('#post-visibility-display').html(); 484 488 485 function updateVisibility() {489 updateVisibility = function() { 486 490 var pvSelect = $('#post-visibility-select'); 487 491 if ( $('input:radio:checked', pvSelect).val() != 'public' ) { … … 496 500 $('#password-span').show(); 497 501 } 498 } 499 500 function updateText() {502 }; 503 504 updateText = function() { 501 505 502 506 if ( ! $('#timestampdiv').length ) … … 537 541 .replace( '%3$s', aa ) 538 542 .replace( '%4$s', hh ) 539 .replace( '%5$s', mn ) 540 +'</b> '543 .replace( '%5$s', mn ) + 544 '</b> ' 541 545 ); 542 546 } … … 544 548 if ( $('input:radio:checked', '#post-visibility-select').val() == 'private' ) { 545 549 $('#publish').val( postL10n.update ); 546 if ( optPublish.length == 0) {550 if ( 0 === optPublish.length ) { 547 551 postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>'); 548 552 } else { … … 575 579 } 576 580 return true; 577 } 581 }; 578 582 579 583 $('.edit-visibility', '#visibility').click(function () { 580 if ( $('#post-visibility-select').is(":hidden")) {584 if ( $( '#post-visibility-select' ).is( ':hidden' ) ) { 581 585 updateVisibility(); 582 586 $('#post-visibility-select').slideDown('fast'); … … 608 612 } // WEAPON LOCKED 609 613 610 if ( true ==$('#sticky').prop('checked') ) {614 if ( $('#sticky').prop('checked') ) { 611 615 sticky = 'Sticky'; 612 616 } else { … … 623 627 624 628 $('#timestampdiv').siblings('a.edit-timestamp').click(function() { 625 if ( $('#timestampdiv').is(":hidden")) {629 if ( $( '#timestampdiv' ).is( ':hidden' ) ) { 626 630 $('#timestampdiv').slideDown('fast'); 627 631 $('#mm').focus(); … … 662 666 663 667 $('#post-status-select').siblings('a.edit-post-status').click(function() { 664 if ( $('#post-status-select').is(":hidden")) {668 if ( $( '#post-status-select' ).is( ':hidden' ) ) { 665 669 $('#post-status-select').slideDown('fast'); 666 670 $(this).hide(); … … 688 692 if ( $('#edit-slug-box').length ) { 689 693 editPermalink = function(post_id) { 690 var i, c = 0, e = $('#editable-post-name'), revert_e = e.html(), real_slug = $('#post_name'), revert_slug = real_slug.val(), b = $('#edit-slug-buttons'), revert_b = b.html(), full = $('#editable-post-name-full').html(); 694 var slug_value, i, 695 c = 0, 696 e = $( '#editable-post-name' ), 697 revert_e = e.html(), 698 real_slug = $( '#post_name' ), 699 revert_slug = real_slug.val(), 700 b = $( '#edit-slug-buttons' ), 701 revert_b = b.html(), 702 full = $( '#editable-post-name-full' ).html(); 691 703 692 704 $('#view-post-btn').hide(); … … 744 756 return false; 745 757 } 746 } ).keyup(function(e) {758 } ).keyup( function() { 747 759 real_slug.val(this.value); 748 760 }).focus(); 749 } 761 }; 750 762 751 763 makeSlugeditClickable = function() { … … 753 765 $('#edit-slug-buttons').children('.edit-slug').click(); 754 766 }); 755 } 767 }; 756 768 makeSlugeditClickable(); 757 769 } … … 780 792 var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text'); 781 793 782 if ( title.val() == '')794 if ( '' === title.val() ) 783 795 titleprompt.removeClass('screen-reader-text'); 784 796 … … 789 801 790 802 title.blur(function(){ 791 if ( this.value == '')803 if ( '' === this.value ) 792 804 titleprompt.removeClass('screen-reader-text'); 793 805 }).focus(function(){ … … 797 809 $(this).unbind(e); 798 810 }); 799 } 811 }; 800 812 801 813 wptitlehint(); … … 813 825 } 814 826 815 function endDrag( e) {827 function endDrag() { 816 828 var height; 817 829 … … 860 872 861 873 // resize TinyMCE to match the textarea height when switching Text -> Visual 862 ed.onLoadContent.add( function( ed, o) {874 ed.onLoadContent.add( function() { 863 875 var ifr_height, node = document.getElementById('content'), 864 876 height = node ? parseInt( node.style.height, 10 ) : 0, … … 883 895 884 896 // resize the textarea to match TinyMCE's height when switching Visual -> Text 885 ed.onSaveContent.add( function( ed, o) {897 ed.onSaveContent.add( function() { 886 898 var height = getHeight(); 887 899 … … 894 906 // save on resizing TinyMCE 895 907 ed.onPostRender.add(function() { 896 $( '#content_resize').on('mousedown.wp-mce-resize', function(e){897 $( document).on('mouseup.wp-mce-resize', function(e){908 $( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() { 909 $( document ).on( 'mouseup.wp-mce-resize', function() { 898 910 var height; 899 911 … … 910 922 911 923 // When changing post formats, change the editor body class 912 $( '#post-formats-select input.post-format').on( 'change.set-editor-class', function( event) {924 $( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() { 913 925 var editor, body, format = this.id; 914 926
Note: See TracChangeset
for help on using the changeset viewer.