/*唉 发现长时间不看 自己写的代码都不认识了 这次不偷懒了老老实实把注释写上*/

	$(function(){	
			   
		
		
	
/*这里开始是隐藏老用户输入框 增加了一些功能 希望可以改善一点用户体验 没有使用淡入淡出是因为IE下会有轻微的对齐Bug 如果对此功能有任何改的地方 还请与我分享*/


		if($('#author').length>0 && $('#author').val().length>0){ //判断ID="author"是否存在 值不为空执行以下代码
	
			$('<p id="welcome">欢迎回来<span id="username"></span></p>').insertBefore('#author_info');
			$('#author_info').slideUp();
		
		
		var ss = $('input[id="author"]').attr("value");
		$('#username').html(" "+ss+"：");
		
		$('#welcome').append("<span id=\"change\">修改资料<\/span><span id=\"update\">点击这里更新资料<\/span><span id=\"hint\">资料修改成功<\/span")
		
		$('#change').click(function(){
							$('#author_info').slideDown(); //显示资料框
							$(this).hide(); //隐藏 修改资料
							$('#update').show(); //显示 更新资料
						});
		
		$('#update').click(function(){
							$('#author_info').slideUp(); //隐藏资料框
							$(this).hide(); //隐藏 更新资料
							$('#hint').show(); //显示 资料修改成功
							setTimeout(function(){$('#hint').hide();},2000); //隐藏 资料修改成功
							setTimeout(function(){$('#change').show();},2000); //还原 修改资料
							var s = $('input[id="author"]').attr("value");
							$('#username').html(" "+s+"：");
						});
		}
		

		
		/*Ctrl+Enter提交评论*/
		
		$('#comment').focus(function(){
								$(document).keydown(function(e){
														if( e.ctrlKey && e.keyCode == 13 ){
															$('#submit').click();
														}
													});
							});
		/*Konami Code 彩蛋*/
		
		
	})