wordpress后台回复也加上@回复

11-20 | 夜光 | IT记录

修改wp-admin/edit-comments.php文件,在如下代码:

</form>

之前添加:

	<script type="text/javascript">
	//<![CDATA[
	/**
	* 光标放在最后 $("#文本框ID").textFocus();
	* 光标放在第二个字符后面 $("#文本框ID").textFocus(2);
	*/
	(function($){
		$.fn.textFocus=function(v){
			var range,len,v=v===undefined?0:parseInt(v);
			this.each(function(){
				if($.browser.msie){
					range=this.createTextRange();
					v===0?range.collapse(false):range.move("character",v);
					range.select();
				}else{
					len=this.value.length;
					v===0?this.setSelectionRange(len,len):this.setSelectionRange(v,v);
				}
				this.focus();
			});
			return this;
		}
	})(jQuery)
	jQuery(document).ready(function($){
		$('.reply').click(function(){
			var atid = '"#' + $(this).parent().parent().parent().attr("id") + '"';
			var atname = $(this).parent().parent().parent().find('strong:first').text().replace(/^\s+|\s+$/g,'');
			$("#replycontent").attr("value","<a href=" + atid + ">@" + atname + " </a>\n").textFocus();
		});
	});
	//]]>
	</script>
本文标签: ,
本文链接: wordpress-admin-at-reply/
版权所有: 玻璃泉, 转载请注明本文出处。

2个评论

  1. 经过测试不行额……