<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<script>
<?php if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").on("click", function() {
if (!g5_is_member) {
alert("다운로드 권한이 없습니다.\n회원이시라면 로그인 후 이용해 보십시오.");
return false;
}
var msg = "파일을 다운로드 하시면 포인트가 차감(<?php echo number_format($board['bo_download_point']) ?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if (confirm(msg)) {
var href = $(this).attr("href") + "&js=on";
$(this).attr("href", href);
return true;
}
return false;
});
});
<?php } ?>
function board_move(href) {
window.open(href, "boardmove", "left=50, top=50, width=500, height=550, scrollbars=1");
}
function openEventEditor(boTable, wrId)
{
var popupUrl = "<?php echo $board_skin_url; ?>/view/event.edit.popup.php?bo_table=" + encodeURIComponent(boTable) + "&wr_id=" + encodeURIComponent(wrId);
var modal = document.getElementById('eventEditorModal');
var frame = document.getElementById('eventEditorFrame');
if (!modal || !frame) {
window.open(popupUrl, "event_edit_popup", "width=980,height=860,left=120,top=60,resizable=yes,scrollbars=yes");
return;
}
frame.src = popupUrl;
modal.classList.add('is-open');
modal.setAttribute('aria-hidden', 'false');
document.body.style.overflow = 'hidden';
}
function closeEventEditorModal()
{
var modal = document.getElementById('eventEditorModal');
var frame = document.getElementById('eventEditorFrame');
if (!modal || !frame) return;
modal.classList.remove('is-open');
modal.setAttribute('aria-hidden', 'true');
frame.src = 'about:blank';
document.body.style.overflow = '';
}
function copyContentById(elementId)
{
var el = document.getElementById(elementId);
if (!el) return;
var txt = (el.innerText || el.textContent || '').trim();
if (!txt) return;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(txt).then(function() {
alert('복사되었습니다.');
});
} else {
var ta = document.createElement('textarea');
ta.value = txt;
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
document.body.removeChild(ta);
alert('복사되었습니다.');
}
}
function downloadContentById(elementId, fileName)
{
var el = document.getElementById(elementId);
if (!el) return;
var txt = (el.innerText || el.textContent || '').trim();
if (!txt) return;
var blob = new Blob([txt], { type: 'text/plain;charset=utf-8' });
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = fileName || 'content.txt';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if (data.error) {
alert(data.error);
return false;
}
if (data.count) {
$el.find("strong").text(number_format(String(data.count)));
if ($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
} else {
$tx.text("이 글을 추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
}
}
},
"json"
);
}
$(function() {
$("a.view_image").on("click", function() {
window.open(this.href, "large_image", "location=yes,links=no,toolbar=no,top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
$("#good_button, #nogood_button").on("click", function() {
var $tx;
if (this.id === "good_button") {
$tx = $("#bo_v_act_good");
} else {
$tx = $("#bo_v_act_nogood");
}
excute_good(this.href, $(this), $tx);
return false;
});
$("#bo_v_atc").viewimageresize();
$(".View-Body-Inner img").viewimageresize();
$(document).on('keydown', function(e) {
if (e.key === 'Escape') {
closeEventEditorModal();
}
});
});
</script>