<script>
// 텍스트 클립보드에 복사
function CopyB() {
var obj = document.getElementById('Time');
var range = document.createRange();
range.selectNode(obj.childNodes[0]); //텍스트 정보를 Range 객체에 저장
var sel = window.getSelection(); sel.removeAllRanges(); //기존 선택정보 삭제
sel.addRange(range); //텍스트 정보 선택
document.execCommand('copy'); //복사
sel.removeRange(range); //선택 정보 삭제
}
// 실시간 시간 출력
var Target = document.getElementById('clock');
var Target2 = document.getElementById('clock2'); // 두번째 실시간 시계
function clock() {
var time = new Date();
var year = time.getYear();
var month = time.getMonth();
var date = time.getDate();
var day = time.getDay();
//var bar = '\u00a0';
var bar = '';
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
Target.innerText =
`${year + 1900}-${month + 1}-${date} ` +
`${hours < 10 ? `0${hours}` : hours}:${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds}` +
` ${bar} `;
Target2.innerText =
`${year + 1900}-${month + 1}-${date} ` +
`${hours < 10 ? `0${hours}` : hours}:${minutes < 10 ? `0${minutes}` : minutes}:${seconds < 10 ? `0${seconds}` : seconds}` +
` ${bar} `; // 두번째 실시간 시계
}
clock();
setInterval(clock, 1000); // 1초마다 실행
</script>
<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>