Index: src/wp-admin/js/post.js
===================================================================
--- src/wp-admin/js/post.js	(revision 26164)
+++ src/wp-admin/js/post.js	(working copy)
@@ -1,3 +1,6 @@
+/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce */
+/* global theList: true, theExtraList: true */
+
 var tagBox, commentsBox, editPermalink, makeSlugeditClickable, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint;
 
 // return an array with any duplicate, whitespace or values removed
@@ -82,10 +85,10 @@
 
 	flushTags : function(el, a, f) {
 		a = a || false;
-		var tags = $('.the-tags', el),
+		var tagsval, newtags, text,
+			tags = $('.the-tags', el),
 			newtag = $('input.newtag', el),
-			comma = postL10n.comma,
-			newtags, text;
+			comma = postL10n.comma;
 
 		text = a ? $(a).text() : newtag.val();
 		tagsval = tags.val();
@@ -108,7 +111,7 @@
 		var tax = id.substr(id.indexOf('-')+1);
 
 		$.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
-			if ( 0 == r || 'success' != stat )
+			if ( 0 === r || 'success' != stat )
 				r = wpAjax.broken;
 
 			r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
@@ -137,7 +140,7 @@
 		});
 
 		$('input.newtag', ajaxtag).blur(function() {
-			if ( this.value == '' )
+			if ( '' === this.value )
 				$(this).parent().siblings('.taghint').css('visibility', '');
 		}).focus(function(){
 			$(this).parent().siblings('.taghint').css('visibility', 'hidden');
@@ -206,7 +209,7 @@
 					$('#the-comment-list').append( r.responses[0].data );
 
 					theList = theExtraList = null;
-					$("a[className*=':']").unbind();
+					$( 'a[className*=\':\']' ).unbind();
 
 					if ( commentsBox.st > commentsBox.total )
 						$('#show-comments').hide();
@@ -240,10 +243,10 @@
 
 WPRemoveThumbnail = function(nonce){
 	$.post(ajaxurl, {
-		action:"set-post-thumbnail", post_id: $('#post_ID').val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
+		action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
 	}, function(str){
 		if ( str == '0' ) {
-			alert( setPostThumbnailL10n.error );
+			window.alert( setPostThumbnailL10n.error );
 		} else {
 			WPSetThumbnailHTML(str);
 		}
@@ -259,10 +262,10 @@
 	if ( ! post_id || ! $('#post-lock-dialog').length )
 		return;
 
-	send['post_id'] = post_id;
+	send.post_id = post_id;
 
 	if ( lock )
-		send['lock'] = lock;
+		send.lock = lock;
 
 	data['wp-refresh-post-lock'] = send;
 });
@@ -288,10 +291,10 @@
 					});
 
 					// Save the latest changes and disable
-					if ( ! autosave() )
+					if ( ! window.autosave() )
 						window.onbeforeunload = null;
 
-					autosave = function(){};
+					window.autosave = function(){};
 				}
 
 				if ( received.lock_error.avatar_src ) {
@@ -401,17 +404,17 @@
 			$('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
 			$(t).show();
 			if ( '#' + taxonomy + '-all' == t )
-				deleteUserSetting(settingName);
+				window.deleteUserSetting( settingName );
 			else
-				setUserSetting(settingName, 'pop');
+				window.setUserSetting( settingName, 'pop' );
 			return false;
 		});
 
-		if ( getUserSetting(settingName) )
+		if ( window.getUserSetting( settingName ) )
 			$('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
 
 		// Ajax Cat
-		$('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } );
+		$( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } );
 
 		$('#new' + taxonomy).keypress( function(event){
 			if( 13 === event.keyCode ) {
@@ -463,7 +466,7 @@
 
 	// Custom Fields
 	if ( $('#postcustom').length ) {
-		$('#the-list').wpList( { addAfter: function( xml, s ) {
+		$( '#the-list' ).wpList( { addAfter: function() {
 			$('table#list-table').show();
 		}, addBefore: function( s ) {
 			s.data += '&post_id=' + $('#post_ID').val();
@@ -531,14 +534,14 @@
 						.replace( '%2$s', jj )
 						.replace( '%3$s', aa )
 						.replace( '%4$s', hh )
-						.replace( '%5$s', mn )
-					+ '</b> '
+						.replace( '%5$s', mn ) +
+						'</b> '
 				);
 			}
 
 			if ( $('input:radio:checked', '#post-visibility-select').val() == 'private' ) {
 				$('#publish').val( postL10n.update );
-				if ( optPublish.length == 0 ) {
+				if ( 0 === optPublish.length ) {
 					postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
 				} else {
 					optPublish.html( postL10n.privatelyPublished );
@@ -572,7 +575,7 @@
 		}
 
 		$('.edit-visibility', '#visibility').click(function () {
-			if ($('#post-visibility-select').is(":hidden")) {
+			if ( $( '#post-visibility-select' ).is( ':hidden' ) ) {
 				updateVisibility();
 				$('#post-visibility-select').slideDown('fast');
 				$(this).hide();
@@ -602,7 +605,7 @@
 				$('#sticky').prop('checked', false);
 			} // WEAPON LOCKED
 
-			if ( true == $('#sticky').prop('checked') ) {
+			if ( true === $('#sticky').prop('checked') ) {
 				sticky = 'Sticky';
 			} else {
 				sticky = '';
@@ -617,7 +620,7 @@
 		});
 
 		$('#timestampdiv').siblings('a.edit-timestamp').click(function() {
-			if ($('#timestampdiv').is(":hidden")) {
+			if ( $( '#timestampdiv' ).is( ':hidden' ) ) {
 				$('#timestampdiv').slideDown('fast');
 				$('#mm').focus();
 				$(this).hide();
@@ -656,7 +659,7 @@
 		});
 
 		$('#post-status-select').siblings('a.edit-post-status').click(function() {
-			if ($('#post-status-select').is(":hidden")) {
+			if ( $( '#post-status-select' ).is( ':hidden' ) ) {
 				$('#post-status-select').slideDown('fast');
 				$(this).hide();
 			}
@@ -682,7 +685,15 @@
 	// permalink
 	if ( $('#edit-slug-box').length ) {
 		editPermalink = function(post_id) {
-			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();
+			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();
 
 			$('#view-post-btn').hide();
 			b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
@@ -738,16 +749,16 @@
 					b.children('.cancel').click();
 					return false;
 				}
-			}).keyup(function(e) {
+			} ).keyup( function() {
 				real_slug.val(this.value);
 			}).focus();
-		}
+		};
 
 		makeSlugeditClickable = function() {
 			$('#editable-post-name').click(function() {
 				$('#edit-slug-buttons').children('.edit-slug').click();
 			});
-		}
+		};
 		makeSlugeditClickable();
 	}
 
@@ -774,7 +785,7 @@
 
 		var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
 
-		if ( title.val() == '' )
+		if ( '' === title.val() )
 			titleprompt.removeClass('screen-reader-text');
 
 		titleprompt.click(function(){
@@ -783,7 +794,7 @@
 		});
 
 		title.blur(function(){
-			if ( this.value == '' )
+			if ( '' === this.value )
 				titleprompt.removeClass('screen-reader-text');
 		}).focus(function(){
 			titleprompt.addClass('screen-reader-text');
@@ -791,7 +802,7 @@
 			titleprompt.addClass('screen-reader-text');
 			$(this).unbind(e);
 		});
-	}
+	};
 
 	wptitlehint();
 
@@ -807,7 +818,7 @@
 			return false;
 		}
 
-		function endDrag(e) {
+		function endDrag() {
 			var height;
 
 			textarea.focus();
@@ -817,7 +828,7 @@
 
 			// sanity check
 			if ( height && height > 50 && height < 5000 )
-				setUserSetting( 'ed_size', height );
+				window.setUserSetting( 'ed_size', height );
 		}
 
 		textarea.css('resize', 'none');
@@ -854,7 +865,7 @@
 			}
 
 			// resize TinyMCE to match the textarea height when switching Text -> Visual
-			ed.onLoadContent.add( function(ed, o) {
+			ed.onLoadContent.add( function() {
 				var ifr_height, node = document.getElementById('content'),
 					height = node ? parseInt( node.style.height, 10 ) : 0,
 					tb_height = $('#content_tbl tr.mceFirst').height() || 33;
@@ -863,8 +874,8 @@
 				if ( !height || height < 50 || height > 5000 )
 					height = 360; // default height for the main editor
 
-				if ( getUserSetting( 'ed_size' ) > 5000  )
-					setUserSetting( 'ed_size', 360 );
+				if ( window.getUserSetting( 'ed_size' ) > 5000  )
+					window.setUserSetting( 'ed_size', 360 );
 
 				// compensate for padding and toolbars
 				ifr_height = ( height - tb_height ) + 12;
@@ -877,7 +888,7 @@
 			});
 
 			// resize the textarea to match TinyMCE's height when switching Visual -> Text
-			ed.onSaveContent.add( function(ed, o) {
+			ed.onSaveContent.add( function() {
 				var height = getHeight();
 
 				if ( !height || height < 50 || height > 5000 )
@@ -888,8 +899,8 @@
 
 			// save on resizing TinyMCE
 			ed.onPostRender.add(function() {
-				$('#content_resize').on('mousedown.wp-mce-resize', function(e){
-					$(document).on('mouseup.wp-mce-resize', function(e){
+				$( '#content_resize' ).on( 'mousedown.wp-mce-resize', function() {
+					$( document ).on( 'mouseup.wp-mce-resize', function() {
 						var height;
 
 						$(document).off('mouseup.wp-mce-resize');
@@ -897,14 +908,14 @@
 						height = getHeight();
 						// sanity check
 						if ( height && height > 50 && height < 5000 )
-							setUserSetting( 'ed_size', height );
+							window.setUserSetting( 'ed_size', height );
 					});
 				});
 			});
 		});
 
 		// When changing post formats, change the editor body class
-		$('#post-formats-select input.post-format').on( 'change.set-editor-class', function( event ) {
+		$( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
 			var editor, body, format = this.id;
 
 			if ( format && $( this ).prop('checked') ) {
