##// END OF EJS Templates
Do not parse links to posts that do not exists in the time of posting.
Do not parse links to posts that do not exists in the time of posting.

File last commit:

r228:8e4f78c8 default
r312:c4a9a992 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('>', '');
}
});
}