GNU/skin/board/daemon_trading_upbit/view.skin.php
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');

// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.view.css">', 0);
?>

<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>

<!-- 게시물 읽기 시작 { -->
<article id="View">
    <!-- 헤더 영역 -->
    <header class="view-header fade-in">
        <div class="view-header-left">
            <h1 class="view-title">
                <?php if ($category_name) { ?>
                <span class="view-category"><?php echo $view['ca_name']; ?></span>
                <?php } ?>
                <span class="view-subject"><?php echo cut_str(get_text($view['wr_subject']), 70); ?></span>
                <?php if (!empty($view['coin_code'])) { ?>
                <span class="view-coin-code"><?php echo htmlspecialchars($view['coin_code']); ?></span>
                <?php } ?>
            </h1>
        </div>
        <div class="view-bottom-actions fade-in">
            <ul class="action-buttons">
                <li><a href="<?php echo $list_href ?>" class="btn-list">데몬 목록</a></li>
                <?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn-write">데몬 등록</a></li><?php } ?>
                <?php if ($update_href) { ?><li><a href="<?php echo $update_href ?>" class="btn-update">데몬 수정</a></li><?php } ?>
                <?php if ($delete_href) { ?><li><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn-delete">데몬 삭제</a></li><?php } ?>
            </ul>
        </div>
    </header>

    <!-- 코인 정보 섹션 -->
    <section class="view-coin-info fade-in">
        <h2 class="section-title">코인 정보</h2>
        <div class="coin-info-grid">
            <div class="info-item">
                <span class="info-label">분류 기준</span>
                <span class="info-value">
                    <?php
                    $criteria_text = '';
                    if (!empty($view['coin_criteria'])) {
                        switch($view['coin_criteria']) {
                            case 'start_price': $criteria_text = '시작가 기준'; break;
                            case 'avg_price': $criteria_text = '평균가 기준'; break;
                            case 'specific_price': $criteria_text = '특정금액 기준'; break;
                            default: $criteria_text = $view['coin_criteria'];
                        }
                    } else {
                        $criteria_text = '-';
                    }
                    echo $criteria_text;
                    ?>
                </span>
            </div>
            <div class="info-item">
                <span class="info-label">형태</span>
                <span class="info-value">
                    <?php
                    $kind_text = '';
                    if (!empty($view['coin_kind'])) {
                        switch($view['coin_kind']) {
                            case 'main': $kind_text = '비트코인'; break;
                            case 'sub1': $kind_text = '메이저 코인'; break;
                            case 'sub2': $kind_text = '메이저 알트 코인'; break;
                            case 'sub3': $kind_text = '잡 알트 코인'; break;
                            case 'sub4': $kind_text = '두더지 코인'; break;
                            case 'sub5': $kind_text = '대멸종 코인'; break;
                            case 'sub6': $kind_text = '광마 코인'; break;
                            default: $kind_text = $view['coin_kind'];
                        }
                    } else {
                        $kind_text = '-';
                    }
                    echo $kind_text;
                    ?>
                </span>
            </div>
            <?php if (!empty($view['price_criteria']) && $view['coin_criteria'] == 'specific_price') { ?>
            <div class="info-item">
                <span class="info-label">특정금액</span>
                <span class="info-value"><?php echo number_format($view['price_criteria']); ?> KRW</span>
            </div>
            <?php } ?>
            <div class="info-item">
                <span class="info-label">코인 종목</span>
                <span class="info-value"><?php echo !empty($view['coin_code']) ? htmlspecialchars($view['coin_code']) : '-'; ?></span>
            </div>
            <div class="info-item">
                <span class="info-label">한글명</span>
                <span class="info-value"><?php echo htmlspecialchars($view['wr_subject']); ?></span>
            </div>
            <div class="info-item">
                <span class="info-label">데몬명</span>
                <span class="info-value"><?php echo strtoupper($view['daemon_file'])?></span>
            </div>
        </div>
    </section>

    <!-- 매수/매도 정보 섹션 -->
    <section class="view-trading-info fade-in">
        <div class="trading-grid">
            <!-- 매수 정보 -->
            <div class="trading-section buy-section">
                <h3 class="trading-title buy-title">
                    매수 정보
                </h3>
                <div class="trading-list">
                    <?php
                    $total_buy_percent = 0;
                    $total_buy_amount = 0;
                    $has_buy_data = false;
                    for ($i = 1; $i <= 10; $i++) {
                        $buy_percent = !empty($view['buy_percent_'.$i]) ? $view['buy_percent_'.$i] : '';
                        $buy_amount = !empty($view['buy_amount_'.$i]) ? $view['buy_amount_'.$i] : '';
                        if ($buy_percent || $buy_amount) {
                            $has_buy_data = true;
                            $total_buy_percent += floatval($buy_percent);
                            $total_buy_amount += floatval(str_replace(',', '', $buy_amount));
                    ?>
                    <div class="trading-item buy-item">
                        <span class="trading-number">매수.<?php echo $i; ?></span>
                        <span class="trading-percent"><?php echo $buy_percent ? number_format($buy_percent, 2) . '%' : '-'; ?></span>
                        <span class="trading-amount"><?php echo $buy_amount ? number_format($buy_amount) . ' KRW' : '-'; ?></span>
                    </div>
                    <?php
                        }
                    }
                    if (!$has_buy_data) {
                        echo '<div class="trading-empty">입력된 매수 정보가 없습니다.</div>';
                    } else {
                    ?>
                    <div class="trading-total buy-total">
                        <span class="total-label">총합</span>
                        <span class="total-percent"><?php echo number_format($total_buy_percent, 2); ?>%</span>
                        <span class="total-amount"><?php echo number_format($total_buy_amount); ?> KRW</span>
                    </div>
                    <?php } ?>
                </div>
            </div>

            <!-- 매도 정보 -->
            <div class="trading-section sell-section">
                <h3 class="trading-title sell-title">
                    매도 정보
                </h3>
                <div class="trading-list">
                    <?php
                    $total_sell_percent = 0;
                    $total_sell_amount = 0;
                    $has_sell_data = false;
                    for ($i = 1; $i <= 10; $i++) {
                        $sell_percent = !empty($view['sell_percent_'.$i]) ? $view['sell_percent_'.$i] : '';
                        $sell_amount = !empty($view['sell_amount_'.$i]) ? $view['sell_amount_'.$i] : '';
                        if ($sell_percent || $sell_amount) {
                            $has_sell_data = true;
                            $total_sell_percent += floatval($sell_percent);
                            $total_sell_amount += floatval(str_replace(',', '', $sell_amount));
                    ?>
                    <div class="trading-item sell-item">
                        <span class="trading-number">매도.<?php echo $i; ?></span>
                        <span class="trading-percent"><?php echo $sell_percent ? number_format($sell_percent, 2) . '%' : '-'; ?></span>
                        <span class="trading-amount"><?php echo $sell_amount ? number_format($sell_amount) . ' KRW' : '-'; ?></span>
                    </div>
                    <?php
                        }
                    }
                    if (!$has_sell_data) {
                        echo '<div class="trading-empty">입력된 매도 정보가 없습니다.</div>';
                    } else {
                    ?>
                    <div class="trading-total sell-total">
                        <span class="total-label">총합</span>
                        <span class="total-percent"><?php echo number_format($total_sell_percent, 2); ?>%</span>
                        <span class="total-amount"><?php echo number_format($total_sell_amount); ?> KRW</span>
                    </div>
                    <?php } ?>
                </div>
            </div>
        </div>
    </section>

    <!-- 본문 내용 -->
    <?php
    // 첨부 이미지와 내용이 있는지 확인
    $has_content = false;
    $content_text = get_view_thumbnail($view['content']);
    $content_text_trimmed = trim(strip_tags($content_text));
    
    // 파일 개수 확인 (이미지만 확인)
    $v_img_count = 0;
    $has_image_files = false;
    if (count($view['file']) > 0) {
        foreach($view['file'] as $view_file) {
            // 이미지 파일인지 확인
            if (isset($view_file['view']) && $view_file['view']) {
                $v_img_count++;
                $has_image_files = true;
            }
        }
    }
    
    // 본문 내용이 있는지 확인
    $has_text = !empty($content_text_trimmed);
    
    // 첨부 이미지와 본문 내용이 모두 없으면 출력하지 않음
    if ($has_image_files || $has_text) {
        $has_content = true;
    }
    
    // 서명이 있는지 확인
    $has_signature = ($is_signature && !empty(trim(strip_tags($signature))));
    
    if ($has_content) {
    ?>
    <section class="view-content fade-in">
        <h2 class="section-title">본문</h2>
        <div class="content-wrapper">
            <?php
            // 이미지 파일 출력
            if($has_image_files) {
                echo "<div class=\"view-images image-gallery\">\n";
                foreach($view['file'] as $view_file) {
                    if (isset($view_file['view']) && $view_file['view']) {
                        echo get_file_thumbnail($view_file);
                    }
                }
                echo "</div>\n";
            }
            ?>
            <?php if ($has_text) { ?>
            <div class="content-text fade-in-text" id="bo_v_atc"><?php echo $content_text; ?></div>
            <?php } ?>
            <?php if ($has_signature) { ?><div class="signature fade-in-text"><?php echo $signature ?></div><?php } ?>
        </div>
    </section>
    <?php } ?>

    <!-- 추천/비추천 -->
    <?php if ( $good_href || $nogood_href) { ?>
    <section class="view-vote fade-in">
        <div class="vote-buttons">
            <?php if ($good_href) { ?>
            <a href="<?php echo $good_href.'&amp;'.$qstr ?>" id="good_button" class="vote-btn vote-good">
                <span>추천</span>
                <strong><?php echo number_format($view['wr_good']) ?></strong>
            </a>
            <b id="bo_v_act_good"></b>
            <?php } ?>
            <?php if ($nogood_href) { ?>
            <a href="<?php echo $nogood_href.'&amp;'.$qstr ?>" id="nogood_button" class="vote-btn vote-nogood">
                <span>비추천</span>
                <strong><?php echo number_format($view['wr_nogood']) ?></strong>
            </a>
            <b id="bo_v_act_nogood"></b>
            <?php } ?>
        </div>
    </section>
    <?php } ?>

    <!-- 첨부파일 -->
    <?php
    $cnt = 0;
    if ($view['file']['count']) {
        for ($i=0; $i<count($view['file']); $i++) {
            if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view'])
                $cnt++;
        }
    }
    if ($cnt) {
    ?>
    <section class="view-files fade-in">
        <h2 class="section-title">첨부파일</h2>
        <ul class="file-list">
            <?php
            for ($i=0; $i<count($view['file']); $i++) {
                if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
            ?>
            <li>
                <a href="<?php echo $view['file'][$i]['href']; ?>" class="view_file_download">
                    <?php echo $view['file'][$i]['source'] ?>
                    <span class="file-size">(<?php echo $view['file'][$i]['size'] ?>)</span>
                </a>
                <span class="file-count"><?php echo $view['file'][$i]['download'] ?>회 다운로드</span>
            </li>
            <?php
                }
            }
            ?>
        </ul>
    </section>
    <?php } ?>

    <!-- 링크 -->
    <?php if ($view['wr_link1'] || $view['wr_link2']) { ?>
    <section class="view-links fade-in">
        <h2 class="section-title">링크</h2>
        <ul class="link-list">
            <?php if ($view['wr_link1']) { ?>
            <li><a href="<?php echo $view['wr_link1'] ?>" target="_blank" rel="nofollow"><?php echo $view['wr_link1'] ?></a></li>
            <?php } ?>
            <?php if ($view['wr_link2']) { ?>
            <li><a href="<?php echo $view['wr_link2'] ?>" target="_blank" rel="nofollow"><?php echo $view['wr_link2'] ?></a></li>
            <?php } ?>
        </ul>
    </section>
    <?php } ?>
</article>
<!-- } 게시판 읽기 끝 -->

<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");
}
</script>

<script>
$(function() {
    // 페이지 로드 시 동적 효과 적용
    function initViewAnimations() {
        // 초기 상태: 모든 fade-in 요소 숨김
        $('.fade-in').css({
            'opacity': '0',
            'transform': 'translateY(20px)'
        });
        
        // 순차적으로 나타나기 (다양한 효과)
        $('.fade-in').each(function(index) {
            var $this = $(this);
            var delay = index * 100;
            var animationType = index % 3; // 3가지 애니메이션 타입 순환
            
            setTimeout(function() {
                switch(animationType) {
                    case 0: // Fade + Slide Up
                        $this.css({
                            'transition': 'opacity 0.6s ease, transform 0.6s ease',
                            'opacity': '1',
                            'transform': 'translateY(0)'
                        });
                        break;
                    case 1: // Fade + Scale
                        $this.css({
                            'transition': 'opacity 0.6s ease, transform 0.6s ease',
                            'opacity': '1',
                            'transform': 'translateY(0) scale(1)'
                        }).css('transform', 'scale(0.95)').delay(50).queue(function() {
                            $(this).css('transform', 'scale(1)').dequeue();
                        });
                        break;
                    case 2: // Fade + Rotate
                        $this.css({
                            'transition': 'opacity 0.6s ease, transform 0.6s ease',
                            'opacity': '1',
                            'transform': 'translateY(0) rotate(0deg)'
                        }).css('transform', 'translateY(0) rotate(-2deg)').delay(50).queue(function() {
                            $(this).css('transform', 'translateY(0) rotate(0deg)').dequeue();
                        });
                        break;
                }
            }, delay);
        });
        
        // 매수/매도 항목 개별 애니메이션 (슬라이드 효과)
        $('.trading-item').each(function(index) {
            var $this = $(this);
            setTimeout(function() {
                $this.css({
                    'transition': 'opacity 0.4s ease, transform 0.4s ease',
                    'opacity': '1',
                    'transform': 'translateX(0)'
                });
            }, 500 + (index * 50));
        });
        
        // 초기 상태 설정
        $('.trading-item').css({
            'opacity': '0',
            'transform': 'translateX(-20px)'
        });
        
        // 이미지 갤러리 애니메이션
        $('.image-gallery img').each(function(index) {
            var $img = $(this);
            $img.css({
                'opacity': '0',
                'transform': 'scale(0.8)'
            });
            setTimeout(function() {
                $img.css({
                    'transition': 'opacity 0.5s ease, transform 0.5s ease',
                    'opacity': '1',
                    'transform': 'scale(1)'
                });
            }, 800 + (index * 100));
        });
        
        // 본문 텍스트 타이핑 효과 (선택적)
        $('.fade-in-text').each(function(index) {
            var $this = $(this);
            $this.css({
                'opacity': '0',
                'transform': 'translateY(10px)'
            });
            setTimeout(function() {
                $this.css({
                    'transition': 'opacity 0.8s ease, transform 0.8s ease',
                    'opacity': '1',
                    'transform': 'translateY(0)'
                });
            }, 1000 + (index * 150));
        });
        
        // 정보 아이템 호버 효과 준비
        $('.info-item').hover(
            function() {
                $(this).css({
                    'transition': 'all 0.3s ease',
                    'transform': 'translateY(-3px) scale(1.02)'
                });
            },
            function() {
                $(this).css({
                    'transform': 'translateY(0) scale(1)'
                });
            }
        );
        
        // 버튼 클릭 리플 효과
        $('.action-buttons a, .vote-btn').on('click', function(e) {
            var $btn = $(this);
            var $ripple = $('<span class="ripple-effect"></span>');
            $btn.append($ripple);
            
            var x = e.pageX - $btn.offset().left;
            var y = e.pageY - $btn.offset().top;
            
            $ripple.css({
                'left': x + 'px',
                'top': y + 'px'
            });
            
            setTimeout(function() {
                $ripple.remove();
            }, 600);
        });
    }
    
    // 페이지 로드 완료 후 애니메이션 시작
    if (document.readyState === 'complete') {
        initViewAnimations();
    } else {
        $(window).on('load', function() {
            setTimeout(initViewAnimations, 100);
        });
    }
    
    $("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;
    });

    // 이미지 리사이즈
    $("#bo_v_atc").viewimageresize();
});

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"
    );
}
</script>
<!-- } 게시글 읽기 끝 -->