3,791
个编辑
MCBBS Wiki欢迎您共同参与编辑!在参与编辑之前请先阅读Wiki方针。
如果在编辑的过程中遇到了什么问题,可以去讨论板提问。
为了您能够无阻碍地参与编辑 未验证/绑定过邮箱的用户,请尽快绑定/验证。
MCBBS Wiki GitHub群组已上线!
您可以在回声洞中发表吐槽!
服务器状态监控。点击进入
本站由MCBBS用户自行搭建,与MCBBS及东银河系漫游指南(北京)科技有限公司没有从属关系。点此了解 MCBBS Wiki 不是什么>>
Sheep-realms(留言 | 贡献) 无编辑摘要 |
Sheep-realms(留言 | 贡献) 无编辑摘要 |
||
| 第28行: | 第28行: | ||
$('.editButtons').after('<div id="edit-bottom-tools"></div>'); | $('.editButtons').after('<div id="edit-bottom-tools"></div>'); | ||
$('#edit-bottom-tools').append('<input type="button" value="测试">'); | $('#edit-bottom-tools').append('<input type="button" value="测试">'); | ||
function codeQueryInsert(code){ | |||
$('textarea #wpTextbox1').insertAtCaret(code); | |||
} | |||
(function ($) { | |||
"use strict"; | |||
$.fn.extend({ | |||
insertAtCaret : function (myValue) { | |||
var $t = $(this)[0]; | |||
if (document.selection) { | |||
this.focus(); | |||
var sel = document.selection.createRange(); | |||
sel.text = myValue; | |||
this.focus(); | |||
} else | |||
if ($t.selectionStart || $t.selectionStart == '0') { | |||
var startPos = $t.selectionStart; | |||
var endPos = $t.selectionEnd; | |||
var scrollTop = $t.scrollTop; | |||
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length); | |||
this.focus(); | |||
$t.selectionStart = startPos + myValue.length; | |||
$t.selectionEnd = startPos + myValue.length; | |||
$t.scrollTop = scrollTop; | |||
} else { | |||
this.value += myValue; | |||
this.focus(); | |||
} | |||
} | |||
}); | |||
})(jQuery); | |||