<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() {
const x2TxtRaw = <?php echo json_encode(isset($x2_txt_raw) ? $x2_txt_raw : ''); ?>;
const x2TxtFilename = <?php echo json_encode(isset($code_filename) ? $code_filename : 'additional.php'); ?>;
$('.View-Body-Inner img').viewimageresize();
$('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;
});
$('#copyX2TxtBtn').on('click', async function() {
if (!x2TxtRaw) return;
try {
await navigator.clipboard.writeText(x2TxtRaw);
} catch (e) {
const $temp = $('<textarea>').val(x2TxtRaw).appendTo('body').select();
document.execCommand('copy');
$temp.remove();
}
});
$('#downloadX2TxtBtn').on('click', function() {
if (!x2TxtRaw) return;
const blob = new Blob([x2TxtRaw], { type: 'text/plain;charset=utf-8' });
let safeFileName = (x2TxtFilename || 'additional.php').replace(/[\\/:*?"<>|]/g, '_');
if (!/\.php$/i.test(safeFileName)) {
safeFileName += '.php';
}
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = safeFileName;
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
});
});
</script>