<script>
// 보드 스크립트
<?php if($write_min || $write_max) { ?>
// 글자수 제한
var char_min = parseInt(<?php echo $write_min; ?>); // 최소
var char_max = parseInt(<?php echo $write_max; ?>); // 최대
check_byte("wr_content", "char_count");
$(function() {
$("#wr_content").on("keyup", function() {
check_byte("wr_content", "char_count");
});
});
<?php } ?>
function html_auto_br(obj)
{
if (obj.checked) {
result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
if (result)
obj.value = "html2";
else
obj.value = "html1";
}
else
obj.value = "";
}
function fwrite_submit(f)
{
<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함 ?>
var subject = "";
var content = "";
$.ajax({
url: g5_bbs_url+"/ajax.filter.php",
type: "POST",
data: {
"subject": f.wr_subject.value,
"content": f.wr_content.value
},
dataType: "json",
async: false,
cache: false,
success: function(data, textStatus) {
subject = data.subject;
content = data.content;
}
});
if (subject) {
alert("제목에 금지단어('"+subject+"')가 포함되어있습니다");
f.wr_subject.focus();
return false;
}
if (content) {
alert("내용에 금지단어('"+content+"')가 포함되어있습니다");
if (typeof(ed_wr_content) != "undefined")
ed_wr_content.returnFalse();
else
f.wr_content.focus();
return false;
}
if (document.getElementById("char_count")) {
if (char_min > 0 || char_max > 0) {
var cnt = parseInt(check_byte("wr_content", "char_count"));
if (char_min > 0 && char_min > cnt) {
alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다.");
return false;
}
else if (char_max > 0 && char_max < cnt) {
alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다.");
return false;
}
}
}
<?php echo $captcha_js; // 캡챠 사용시 자바스크립트에서 입력된 캡챠를 검사함 ?>
document.getElementById("btn_submit").disabled = "disabled";
return true;
}
<?php if ($is_file) {?>
function addFileInput() {
var flen = $("input[name='bf_file[]']").length;
var upload_count = <?php echo (int)$file_count?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var appendHtml = "";
appendHtml += "<tr>";
appendHtml += "<td class='Name'>파일</td>";
appendHtml += "<td class='Value'>";
appendHtml += "<input type='file' name='bf_file[]' title='파일첨부 : 용량 <?php echo $upload_max_filesize ?> 바이트 이하만 업로드 가능' class='frm_file frm_input' style='display:inline-block;'>";
appendHtml += "<button type='button' class='btn_frmline fwzdel'>삭제</button>";
<?php if ($is_file_content) { ?>
appendHtml += "<input type='text' name='bf_content[]' value='' title='파일 설명을 입력해주세요.' class='frm_file frm_input' size='50'>";
<?php } ?>
appendHtml += "</td>";
appendHtml += "</tr>";
$(".tbl_frm table:first-child").append(appendHtml);
}
$(document).ready(function(){
// 첨부파일 추가.
$('.tbl_frm table .fwzadd').live('click',(function() {
addFileInput();
}));
// 첨부파일 삭제.
$('.tbl_frm table .fwzdel').live('click',(function() {
$(this).parents("tr:first").remove();
}));
});
<?php } ?>
</script>
<script>
$(function() {
$('#id_x2_memo_button').on('change', function() {
if($(this).is(':checked')) {
$('#memo_row').show();
$('#memo_panel_wrap').slideDown();
} else {
$('#memo_panel_wrap').slideUp(function() {
$('#memo_row').hide();
});
}
});
});
</script>
<script>
function toggleExtra() {
const $area = $('#extra_area');
const $icon = $('#toggle_icon');
// stop()을 넣어야 여러 번 클릭해도 애니메이션이 꼬이지 않아, 씨발!
$area.stop().slideToggle(300, function() {
if ($area.is(':visible')) {
// 열렸을 때: 화살표 위로
$icon.removeClass('fa-chevron-down').addClass('fa-chevron-up');
} else {
// 닫혔을 때: 화살표 아래로
$icon.removeClass('fa-chevron-up').addClass('fa-chevron-down');
}
});
}
</script>