##// END OF EJS Templates
Moved 'favorite' link in tag list to the beginning to align them
Moved 'favorite' link in tag list to the beginning to align them

File last commit:

r228:8e4f78c8 default
r290:5c9ac652 default
Show More
panel.js
34 lines | 1.2 KiB | application/javascript | JavascriptLexer
function addMarkToMsg(start, end) {
var textarea = document.getElementById('id_text');
if(!textarea) return;
if( document.selection ) {
textarea.focus();
sel = document.selection.createRange();
sel.text = start + sel.text + end;
} else if(textarea.selectionStart || textarea.selectionStart == '0') {
textarea.focus();
var startPos = textarea.selectionStart;
var endPos = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, startPos) + start + textarea.value.substring(startPos, endPos) + end + textarea.value.substring( endPos, textarea.value.length );
} else {
textarea.value += start + end;
}
return false;
}
function addMarkPanel() {
$('.mark_btn').on('click', function() {
switch($(this).attr('id')) {
case "italic":
return addMarkToMsg('_', '_');
case "bold":
return addMarkToMsg('__', '__');
case "spoiler":
return addMarkToMsg('%%', '%%');
case "comment":
return addMarkToMsg('//', '');
case "quote":
return addMarkToMsg('>', '');
}
});
}