98 lines
2.2 KiB
JavaScript
98 lines
2.2 KiB
JavaScript
/**
|
|
* 알림톡 템플릿 내용 글자수 체크 및 표시, 미리보기 내용 표시
|
|
*
|
|
*
|
|
*/
|
|
|
|
function setContentsLeng(contents){
|
|
|
|
var conLeng = strMaxCharacterCnt(contents);
|
|
|
|
if(conLeng > 1000){
|
|
|
|
alert("알림톡 내용은 1000자를 넘을 수 없습니다.");
|
|
var splicecon = strMaxLengthSubstring(contents, 999);
|
|
$('#inputTemplateContent').val(splicecon);
|
|
return false;
|
|
|
|
}else{//현재 입력한 글자수 우측 하단에 표시해 주기
|
|
|
|
var repContent = "";
|
|
repContent = contents.replace(/(?:\r\n|\r|\n)/g, '<br/>');
|
|
|
|
$('.nowChar').text(conLeng + " /");
|
|
$('.template_text').show();
|
|
if(repContent != ''){
|
|
$('.template_text').html(repContent);
|
|
}else{
|
|
$('.template_text').html("내용 미리보기");
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* 친구톡 템플릿 내용 글자수 체크 및 표시, 미리보기 내용 표시
|
|
*
|
|
*
|
|
*/
|
|
|
|
function setContentsLengForFriends(contents){
|
|
|
|
var conLeng = strMaxCharacterCnt(contents);
|
|
var imageType = $("input[name=img_file_add]:checked").val();
|
|
var limitLeng = 1000;
|
|
|
|
if(imageType == 'I'){
|
|
|
|
limitLeng = 400;
|
|
|
|
if(conLeng > limitLeng){
|
|
|
|
alert("일반 이미지 첨부시 친구톡 내용은 400자를 넘을 수 없습니다.");
|
|
|
|
}
|
|
|
|
}else if(imageType == 'W'){
|
|
|
|
limitLeng = 76;
|
|
|
|
if(conLeng > limitLeng){
|
|
|
|
alert("와이드 이미지 첨부시 친구톡 내용은 76자를 넘을 수 없습니다.");
|
|
|
|
}
|
|
|
|
}else if(conLeng > 1000){
|
|
|
|
alert("친구톡 내용은 1000자를 넘을 수 없습니다.");
|
|
|
|
}
|
|
|
|
//제한글자수를 넘겼을 경우 최대 글자수까지 잘라주고 미리보기 및 글자수 표시처리
|
|
if(conLeng > limitLeng){
|
|
|
|
var splicecon = strMaxLengthSubstring(contents, limitLeng-1);
|
|
$('#inputTemplateContent').val(splicecon);
|
|
contents = splicecon;
|
|
conLeng = strMaxCharacterCnt(contents);
|
|
|
|
}
|
|
|
|
var repContent = "";
|
|
repContent = contents.replace(/(?:\r\n|\r|\n)/g, '<br/>');
|
|
|
|
$('.nowChar').text(conLeng + " /");
|
|
$('.totChar').text(" "+limitLeng);
|
|
$('.template_text').show();
|
|
if(repContent != ''){
|
|
$('.template_text').html(repContent);
|
|
$('#smsTxtArea').val(
|
|
$('.template_text').html().trim().replace(/(<br>|<br\/>|<br \/>)/g, '\r\n')
|
|
);
|
|
}else{
|
|
$('.template_text').html("내용 미리보기");
|
|
}
|
|
|
|
} |