<!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>[26204] trunk/src/wp-admin/js/post.js: Fix JSHint errors in 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/26204">26204</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-11-15 05:34:14 +0000 (Fri, 15 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix JSHint errors in post.js.
props atimmer.
fixes <a href="http://core.trac.wordpress.org/ticket/25994">#25994</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjspostjs">trunk/src/wp-admin/js/post.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjspostjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/post.js (26203 => 26204)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/post.js 2013-11-15 05:26:00 UTC (rev 26203)
+++ trunk/src/wp-admin/js/post.js 2013-11-15 05:34:14 UTC (rev 26204)
</span><span class="lines">@@ -1,3 +1,6 @@
</span><ins>+/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting, getUserSetting, setUserSetting */
+/* global theList:true, theExtraList:true, autosave:true */
+
</ins><span class="cx"> var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
</span><span class="cx">
</span><span class="cx"> // return an array with any duplicate, whitespace or values removed
</span><span class="lines">@@ -81,11 +84,11 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> flushTags : function(el, a, f) {
</span><ins>+ var tagsval, newtags, text,
+ tags = $('.the-tags', el),
+ newtag = $('input.newtag', el),
+ comma = postL10n.comma;
</ins><span class="cx"> a = a || false;
</span><del>- var tags = $('.the-tags', el),
- newtag = $('input.newtag', el),
- comma = postL10n.comma,
- newtags, text;
</del><span class="cx">
</span><span class="cx"> text = a ? $(a).text() : newtag.val();
</span><span class="cx"> tagsval = tags.val();
</span><span class="lines">@@ -108,7 +111,7 @@
</span><span class="cx"> var tax = id.substr(id.indexOf('-')+1);
</span><span class="cx">
</span><span class="cx"> $.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
</span><del>- if ( 0 == r || 'success' != stat )
</del><ins>+ if ( 0 === r || 'success' != stat )
</ins><span class="cx"> r = wpAjax.broken;
</span><span class="cx">
</span><span class="cx"> r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
</span><span class="lines">@@ -137,7 +140,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> $('input.newtag', ajaxtag).blur(function() {
</span><del>- if ( this.value == '' )
</del><ins>+ if ( '' === this.value )
</ins><span class="cx"> $(this).parent().siblings('.taghint').css('visibility', '');
</span><span class="cx"> }).focus(function(){
</span><span class="cx"> $(this).parent().siblings('.taghint').css('visibility', 'hidden');
</span><span class="lines">@@ -206,7 +209,7 @@
</span><span class="cx"> $('#the-comment-list').append( r.responses[0].data );
</span><span class="cx">
</span><span class="cx"> theList = theExtraList = null;
</span><del>- $("a[className*=':']").unbind();
</del><ins>+ $( 'a[className*=\':\']' ).unbind();
</ins><span class="cx">
</span><span class="cx"> if ( commentsBox.st > commentsBox.total )
</span><span class="cx"> $('#show-comments').hide();
</span><span class="lines">@@ -240,7 +243,7 @@
</span><span class="cx">
</span><span class="cx"> WPRemoveThumbnail = function(nonce){
</span><span class="cx"> $.post(ajaxurl, {
</span><del>- action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
</del><ins>+ action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
</ins><span class="cx"> }, function(str){
</span><span class="cx"> if ( str == '0' ) {
</span><span class="cx"> alert( setPostThumbnailL10n.error );
</span><span class="lines">@@ -259,10 +262,10 @@
</span><span class="cx"> if ( ! post_id || ! $('#post-lock-dialog').length )
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- send['post_id'] = post_id;
</del><ins>+ send.post_id = post_id;
</ins><span class="cx">
</span><span class="cx"> if ( lock )
</span><del>- send['lock'] = lock;
</del><ins>+ send.lock = lock;
</ins><span class="cx">
</span><span class="cx"> data['wp-refresh-post-lock'] = send;
</span><span class="cx"> });
</span><span class="lines">@@ -351,7 +354,8 @@
</span><span class="cx"> }(jQuery));
</span><span class="cx">
</span><span class="cx"> jQuery(document).ready( function($) {
</span><del>- var stamp, visibility, sticky = '', last = 0, co = $('#content');
</del><ins>+ var stamp, visibility, updateVisibility, updateText,
+ sticky = '', last = 0, co = $('#content');
</ins><span class="cx">
</span><span class="cx"> postboxes.add_postbox_toggles(pagenow);
</span><span class="cx">
</span><span class="lines">@@ -406,17 +410,17 @@
</span><span class="cx"> $('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
</span><span class="cx"> $(t).show();
</span><span class="cx"> if ( '#' + taxonomy + '-all' == t )
</span><del>- deleteUserSetting(settingName);
</del><ins>+ deleteUserSetting( settingName );
</ins><span class="cx"> else
</span><del>- setUserSetting(settingName, 'pop');
</del><ins>+ setUserSetting( settingName, 'pop' );
</ins><span class="cx"> return false;
</span><span class="cx"> });
</span><span class="cx">
</span><del>- if ( getUserSetting(settingName) )
</del><ins>+ if ( getUserSetting( settingName ) )
</ins><span class="cx"> $('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
</span><span class="cx">
</span><span class="cx"> // Ajax Cat
</span><del>- $('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
</del><ins>+ $( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } );
</ins><span class="cx">
</span><span class="cx"> $('#new' + taxonomy).keypress( function(event){
</span><span class="cx"> if( 13 === event.keyCode ) {
</span><span class="lines">@@ -468,7 +472,7 @@
</span><span class="cx">
</span><span class="cx"> // Custom Fields
</span><span class="cx"> if ( $('#postcustom').length ) {
</span><del>- $('#the-list').wpList( { addAfter: function( xml, s ) {
</del><ins>+ $( '#the-list' ).wpList( { addAfter: function() {
</ins><span class="cx"> $('table#list-table').show();
</span><span class="cx"> }, addBefore: function( s ) {
</span><span class="cx"> s.data += '&post_id=' + $('#post_ID').val();
</span><span class="lines">@@ -482,7 +486,7 @@
</span><span class="cx"> stamp = $('#timestamp').html();
</span><span class="cx"> visibility = $('#post-visibility-display').html();
</span><span class="cx">
</span><del>- function updateVisibility() {
</del><ins>+ updateVisibility = function() {
</ins><span class="cx"> var pvSelect = $('#post-visibility-select');
</span><span class="cx"> if ( $('input:radio:checked', pvSelect).val() != 'public' ) {
</span><span class="cx"> $('#sticky').prop('checked', false);
</span><span class="lines">@@ -495,9 +499,9 @@
</span><span class="cx"> } else {
</span><span class="cx"> $('#password-span').show();
</span><span class="cx"> }
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><del>- function updateText() {
</del><ins>+ updateText = function() {
</ins><span class="cx">
</span><span class="cx"> if ( ! $('#timestampdiv').length )
</span><span class="cx"> return true;
</span><span class="lines">@@ -536,14 +540,14 @@
</span><span class="cx"> .replace( '%2$s', jj )
</span><span class="cx"> .replace( '%3$s', aa )
</span><span class="cx"> .replace( '%4$s', hh )
</span><del>- .replace( '%5$s', mn )
- + '</b> '
</del><ins>+ .replace( '%5$s', mn ) +
+ '</b> '
</ins><span class="cx"> );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( $('input:radio:checked', '#post-visibility-select').val() == 'private' ) {
</span><span class="cx"> $('#publish').val( postL10n.update );
</span><del>- if ( optPublish.length == 0 ) {
</del><ins>+ if ( 0 === optPublish.length ) {
</ins><span class="cx"> postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
</span><span class="cx"> } else {
</span><span class="cx"> optPublish.html( postL10n.privatelyPublished );
</span><span class="lines">@@ -574,10 +578,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> $('.edit-visibility', '#visibility').click(function () {
</span><del>- if ($('#post-visibility-select').is(":hidden")) {
</del><ins>+ if ( $( '#post-visibility-select' ).is( ':hidden' ) ) {
</ins><span class="cx"> updateVisibility();
</span><span class="cx"> $('#post-visibility-select').slideDown('fast');
</span><span class="cx"> $(this).hide();
</span><span class="lines">@@ -607,7 +611,7 @@
</span><span class="cx"> $('#sticky').prop('checked', false);
</span><span class="cx"> } // WEAPON LOCKED
</span><span class="cx">
</span><del>- if ( true == $('#sticky').prop('checked') ) {
</del><ins>+ if ( $('#sticky').prop('checked') ) {
</ins><span class="cx"> sticky = 'Sticky';
</span><span class="cx"> } else {
</span><span class="cx"> sticky = '';
</span><span class="lines">@@ -622,7 +626,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> $('#timestampdiv').siblings('a.edit-timestamp').click(function() {
</span><del>- if ($('#timestampdiv').is(":hidden")) {
</del><ins>+ if ( $( '#timestampdiv' ).is( ':hidden' ) ) {
</ins><span class="cx"> $('#timestampdiv').slideDown('fast');
</span><span class="cx"> $('#mm').focus();
</span><span class="cx"> $(this).hide();
</span><span class="lines">@@ -661,7 +665,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> $('#post-status-select').siblings('a.edit-post-status').click(function() {
</span><del>- if ($('#post-status-select').is(":hidden")) {
</del><ins>+ if ( $( '#post-status-select' ).is( ':hidden' ) ) {
</ins><span class="cx"> $('#post-status-select').slideDown('fast');
</span><span class="cx"> $(this).hide();
</span><span class="cx"> }
</span><span class="lines">@@ -687,7 +691,15 @@
</span><span class="cx"> // permalink
</span><span class="cx"> if ( $('#edit-slug-box').length ) {
</span><span class="cx"> editPermalink = function(post_id) {
</span><del>- 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();
</del><ins>+ var slug_value, 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();
</ins><span class="cx">
</span><span class="cx"> $('#view-post-btn').hide();
</span><span class="cx"> b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
</span><span class="lines">@@ -743,16 +755,16 @@
</span><span class="cx"> b.children('.cancel').click();
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><del>- }).keyup(function(e) {
</del><ins>+ } ).keyup( function() {
</ins><span class="cx"> real_slug.val(this.value);
</span><span class="cx"> }).focus();
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> makeSlugeditClickable = function() {
</span><span class="cx"> $('#editable-post-name').click(function() {
</span><span class="cx"> $('#edit-slug-buttons').children('.edit-slug').click();
</span><span class="cx"> });
</span><del>- }
</del><ins>+ };
</ins><span class="cx"> makeSlugeditClickable();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -779,7 +791,7 @@
</span><span class="cx">
</span><span class="cx"> var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
</span><span class="cx">
</span><del>- if ( title.val() == '' )
</del><ins>+ if ( '' === title.val() )
</ins><span class="cx"> titleprompt.removeClass('screen-reader-text');
</span><span class="cx">
</span><span class="cx"> titleprompt.click(function(){
</span><span class="lines">@@ -788,7 +800,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> title.blur(function(){
</span><del>- if ( this.value == '' )
</del><ins>+ if ( '' === this.value )
</ins><span class="cx"> titleprompt.removeClass('screen-reader-text');
</span><span class="cx"> }).focus(function(){
</span><span class="cx"> titleprompt.addClass('screen-reader-text');
</span><span class="lines">@@ -796,7 +808,7 @@
</span><span class="cx"> titleprompt.addClass('screen-reader-text');
</span><span class="cx"> $(this).unbind(e);
</span><span class="cx"> });
</span><del>- }
</del><ins>+ };
</ins><span class="cx">
</span><span class="cx"> wptitlehint();
</span><span class="cx">
</span><span class="lines">@@ -812,7 +824,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function endDrag(e) {
</del><ins>+ function endDrag() {
</ins><span class="cx"> var height;
</span><span class="cx">
</span><span class="cx"> textarea.focus();
</span><span class="lines">@@ -859,7 +871,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // resize TinyMCE to match the textarea height when switching Text -> Visual
</span><del>- ed.onLoadContent.add( function(ed, o) {
</del><ins>+ ed.onLoadContent.add( function() {
</ins><span class="cx"> var ifr_height, node = document.getElementById('content'),
</span><span class="cx"> height = node ? parseInt( node.style.height, 10 ) : 0,
</span><span class="cx"> tb_height = $('#content_tbl tr.mceFirst').height() || 33;
</span><span class="lines">@@ -882,7 +894,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // resize the textarea to match TinyMCE's height when switching Visual -> Text
</span><del>- ed.onSaveContent.add( function(ed, o) {
</del><ins>+ ed.onSaveContent.add( function() {
</ins><span class="cx"> var height = getHeight();
</span><span class="cx">
</span><span class="cx"> if ( !height || height < 50 || height > 5000 )
</span><span class="lines">@@ -893,8 +905,8 @@
</span><span class="cx">
</span><span class="cx"> // save on resizing TinyMCE
</span><span class="cx"> ed.onPostRender.add(function() {
</span><del>- $('#content_resize').on('mousedown.wp-mce-resize', function(e){
- $(document).on('mouseup.wp-mce-resize', function(e){
</del><ins>+ $( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() {
+ $( document ).on( 'mouseup.wp-mce-resize', function() {
</ins><span class="cx"> var height;
</span><span class="cx">
</span><span class="cx"> $(document).off('mouseup.wp-mce-resize');
</span><span class="lines">@@ -909,7 +921,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // When changing post formats, change the editor body class
</span><del>- $('#post-formats-select input.post-format').on( 'change.set-editor-class', function( event ) {
</del><ins>+ $( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
</ins><span class="cx"> var editor, body, format = this.id;
</span><span class="cx">
</span><span class="cx"> if ( format && $( this ).prop('checked') ) {
</span></span></pre>
</div>
</div>
</body>
</html>