$(function() {
if($('#wmd-button-row').length>0)$('#wmd-button-row').append('
');
$(document).on('click', '#wmd-music-button', function() {
$('body').append(
''+
'
'+
'
'+
'
'+
'
插入音乐
'+
'
请在下方的输入框内输入要插入的音乐地址,如多个地址请用回车隔开'+
'
'+
'
'+
'
'+
'
'+
'
');
$('.wmd-prompt-dialog textarea').val('http://').select();
});
$(document).on('click','#cancel',function() {
$('#MetingPanel').remove();
$('textarea').focus();
});
$(document).on('click','#ok',function() {
callback=$.ajax({
type:'POST',
url:murl,
data:{data:$('.wmd-prompt-dialog textarea').val()},
async:false
});
$('#MetingPanel').remove();
myField = document.getElementById('text');
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = callback.responseText;
myField.focus();
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
var cursorPos = startPos;
myField.value = myField.value.substring(0, startPos)
+ callback.responseText
+ myField.value.substring(endPos, myField.value.length);
cursorPos += callback.responseText.length;
myField.focus();
myField.selectionStart = cursorPos;
myField.selectionEnd = cursorPos;
}
else{
myField.value += callback.responseText;
myField.focus();
}
});
});