<script>
<?php if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").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;
} else {
return false;
}
});
});
<?php } ?>
function board_move(href) { window.open(href, "boardmove", "left=50, top=50, width=500, height=550, scrollbars=1"); }
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() {
const x2TxtRaw = <?php echo json_encode(isset($x2_txt_raw) ? $x2_txt_raw : ''); ?>;
const x2TxtFilename = <?php echo json_encode(isset($code_filename) ? $code_filename : 'download.txt'); ?>;
$(".View-Body-Inner img").viewimageresize();
$("a.view_image").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").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;
});
$('#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' });
const safeFileName = (x2TxtFilename || 'download.txt').replace(/[\\/:*?"<>|]/g, '_');
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>