<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>{{ RAW.title }}</title>
    <link href="../../assets/favicon.ico" rel="shortcut icon">
    <link type="text/css" rel="stylesheet" href="../../assets/css/base.css"/>
    <link type="text/css" rel="stylesheet" href="../../assets/css/video.css"/>
    <link type="text/css" rel="stylesheet" href="../../assets/css/player.css"/>
    <link type="text/css" rel="stylesheet" href="../../assets/css/comment.css"/>
    <link type="text/css" rel="stylesheet" href="../../assets/css/pager.min.css"/>
    <script type="text/javascript" src="../../assets/js/lazyload.min.js"></script>
    <script type="text/javascript">var lazyLoadInstance = new LazyLoad({});</script>
    <style>
        .left-column.unfold{
            width: 100% !important;
            max-width: calc(100% - 40px) !important;
        }
        .right-column.unfold{
            width: 0 !important;
        }
        .left-column.unfold #player{
            position: unset !important;
        }
    </style>
</head>
<body>
{% include 'parts/header.html' %}
<div id="main" class="single-part">
    <div id="main-content" class="clearfix" style="margin: 0 auto;">
        <div class="left-column">
            <div class="player-box">
                <div id="player">
                    <div id="ACPlayer">
                        <div class="container-player" style="">
                            <div class="container-video">
                                <video id="localPlayer" preload="auto" poster="cover._" controls>
                                    <source src="ac{{ v_num }}.mp4" type="video/mp4">
                                </video>
                                <div class="container-plugins-inner">
                                    <div class="container-controls">
                                        <div class="video-status" data-bind-key="playStatus" data-bind-attr="pause"></div>
                                    </div>
                                    <div class='player-plugin-advanced-danmaku-container'>
                                        <div class='danmaku-g-rendered-stage' style="width: 100%;height: 100%;"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="container-plugins-outer"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="video-description clearfix dark-style">
                <h1 class="title">
<!--                    <a class="reco-tag" href="https://www.acfun.cn/rank/list/#cid=-1;range=1;pcid=-3" title="综合榜Top2" target="_blank">综合榜Top2</a>-->
                    <a id="srcUrl" href="https://www.acfun.cn/v/ac{{ v_num }}"><span>{{ RAW.title }}</span></a>
                </h1>
                <div class="action-area">
                    <div class="left-area">
                        {% if RAW.originalDeclare %}
                        <div class="originalDeclare" style="display: inline-block;"><span class="originalDeclareText icon-ks icon-icon_-jin-zhi-zhuan-zai">未经作者授权，禁止转载</span></div>
                        {% endif %}
                        <div class="views"><span class="viewsCount" title="{{ RAW.viewCount }}">{{ RAW.viewCountShow }}</span>播放</div>
                        <div class="danmu"><span class="danmuCount sp2" title="{{ RAW.danmakuCount }}">{{ RAW.danmakuCountShow }}</span>弹幕</div>
                        <div class="comment"><span class="commentCount" title="{{ RAW.commentCount }}">{{ RAW.commentCountShow }}</span>评论</div>
                        <div class="cache"><span>{{ cache_date }}</span><span>缓存</span></div>
                    </div>
                    <div class="right-area">
                        <div class="like"><span class="icon"></span><span class="likeCount" title="{{ RAW.likeCount }}">{{ RAW.likeCountShow }}</span></div>
                        <div class="collection"><span class="icon"></span><span class="collectionCount" title="{{ RAW.stowCount }}">{{ RAW.stowCountShow }}</span></div>
                        <div class="banana"><span class="icon"></span><span class="bananaCount" title="{{ RAW.bananaCount }}">{{ RAW.bananaCountShow }}</span></div>
                        <div class="share"><span class="icon"></span><span title="{{ RAW.shareCount }}">{{ RAW.shareCountShow }}</span>
                            <div class="share-module">
                                <div class="share-title">分享本视频给朋友吧</div>
                                <div class="share-action-area">
                                    <div class="share-left-area">
                                        <div class="qrcode"><img src="data/share_qrcode.png"></div>
                                        <p class="scan">扫一扫</p><p>分享到微信/朋友圈</p>
                                    </div>
                                    <div class="share-right-area">
                                        <div class="share-type"></div>
                                        <div class="share-container">
                                            <div id="share-component">
                                                <div class="share-desc">获取原视频地址</div>
                                                <div class="area-share clearfix">
                                                    <input id="videoUrl" class="ipt-url fl" type="text" readonly="readonly" value="https://www.acfun.cn/v/ac{{ v_num }}">
                                                    <span data-clipboard-target="#videoUrl" class="copy fl cp-url" onclick="copyText('https://www.acfun.cn/v/ac{{ v_num }}')">复制</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="mobile" style="display: inline-block;"><span class="icon"></span>
                            <div class="mobile-module">
                                <div class="mobile-title">手机扫码观看视频</div>
                                <div class="mobile-action-area">
                                    <div class="mobile-left-area">
                                        <div class="qrcode">
                                            <img src="data/mobile_qrcode.png">
                                        </div>
                                        <p>扫一扫手机继续观看</p></div>
                                    <div class="mobile-right-area"><p>{{ RAW.title }}</p></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="introduction">
                <div class="up-area">{% set hasStaffContribute = RAW.get('staffContribute') == True %}
                    {% if not hasStaffContribute %}
                    <div class="up-details">
                        <a href="https://www.acfun.cn/u/{{ RAW.user.href }}" class="up-avatar up-avatar-wrapper" target="_blank">
                            <img src="../../member/{{ RAW.user.href }}_avatar" class="avatar live-avatar">
                        </a>
                        <div class="up-data">
                            <div class="up-info">
                                <a class="up-name" href="https://www.acfun.cn/u/{{ RAW.user.href }}" target="_blank" title="注册于 {{ up_reg_date }}"
                                        {% if RAW.user.nameColor == 1 %} style="{{ RAW.user.nameStyle }}"{% endif %}>{{ RAW.user.name }}</a>
                                {% if 1 in RAW.user.verifiedTypes %}
                                <span class="verified-icon monkey-verified-icon" title="AcFun管理员认证"></span>
                                {% endif %}
                                {% if 2 in RAW.user.verifiedTypes %}
                                <span class="verified-icon official-verified-icon" title="{{ "AcFun官方认证\n"|safe + RAW.user.verifiedText or '' }}"></span>
                                {% endif %}
                                {% if 5 in RAW.user.verifiedTypes %}
                                <span class="up-college-verified verified-icon">
                                    <span class="verified-icon up-college-verified-icon"></span>
                                    <span class="up-college-verified-content">
                                        <span class="up-college-verified-content-text">尊贵的阿普学院标志
                                            <a rel="noopener" class="link" href="//member.acfun.cn/academy" target="_blank">如何获得标志？</a>
                                        </span>
                                    </span>
                                </span>
                                {% endif %}
                                <span class="verified-icon avi-verified-icon" title="AVI虚拟偶像标识" style="display: none;"></span>
                                <span class="verified-icon advanced-danmaku-verified-icon" title="高弹达人标识" style="display:none"></span>
                            </div>
                            <div class="publish-time">发布于&nbsp;{{ RAW.createTimeMillis|unix2datestr }}</div>
                        </div>
                    </div>
                    {% else %}
                        <div class="up-details staff-details">
                            <a href="/u/{{ RAW.user.href }}" class="up-avatar up-avatar-wrapper" target="_blank">
                                <img src="../../member/{{ RAW.user.href }}_avatar" class="avatar live-avatar">
                            </a>
                            <a href="/u/{{ RAW.user.href }}" class="up-name">{{ RAW.user.name }}</a>
                            <div class="role">{{ RAW.upInfo.staffRoleName }}</div><div class="follow hidden">+</div>
                        </div>
                    {% for staff in RAW.get('staffInfos') %}
                    <div class="staff-details">
                        <div>
                            <a href="https://www.acfun.cn/u/{{ staff.href }}" target="_blank" class="staff-avatar">
                                <img alt="{{ staff.verifiedText }}" src="../../member/{{ staff.href }}_avatar" class="avatar live-avatar">
                            </a>
                        </div>
                        <a href="https://www.acfun.cn/u/{{ staff.href }}" class="staff-name">{{ staff.name }}</a>
                        <div class="role">{{ staff.staffRoleName }}</div><div class="follow hidden">+</div>
                    </div>
                    {% endfor %}
                    {% endif %}
                    <div class="up-interactive">
                        <div class="follow-up not-follow" title="{{ RAW.fanCountValue }}">关注&nbsp;{{ RAW.user.fanCount }}</div>
<!--                            <div class="btn-reward">鼓励</div>-->
                    </div>
                </div>
                <div class="content-description">
                    <div class="description-container">{{ RAW.description or "" }}</div>
                    <div class="originalLink">{{ RAW.originalLinkUrl or "" }}</div>
                    <div class="tag" id="bd_tag">
                        {% for tag in RAW.tagList %}
                        <span class="tag-single fl">
                            <a href="https://www.acfun.cn/search?keyword={{ tag.name }}" data-tid="{{ tag.id }}" target="_blank" class="fl">{{ tag.name }}</a>
                        </span>
                        {% endfor %}
                    </div>
                </div>
            </div>
            {% include "parts/comment.html" %}
        </div>
        <div class="right-column">
            <div id="danmaku" style="display: block;">
                <div class="danmaku-wrapper unfold">
                    <div class="danmaku-container">
                        <div class="danmaku-list-container">
                            <div class="danmaku-list">
                                <div class="list-title">
                                    <div class="time-grid">时间<i></i></div>
                                    <div class="content-grid">弹幕内容<i></i></div>
                                </div>
                                <div class="list-body">
                                    <div class="scroll-content">
                                        <ul class="danmaku-items" id="danmaku-items">
                                        </ul>
                                    </div>
                                    <div class="message-box"></div>
                                    <div class="danmaku-page">
                                        <div class="last-page"></div>
                                        <div class="current-page">
                                            <div class="cur-page">
                                                <span id="page-info"></span>
                                                <i></i>
                                            </div>
                                            <ul class="page-pool">
                                                <li data-page="3">第3页</li>
                                                <li data-page="2">第2页</li>
                                                <li data-page="1">第1页</li>
                                            </ul>
                                        </div>
                                        <div class="next-page"></div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="danmaku-fold unfold">弹幕列表</div>
                </div>
            </div>
            {% if RAW.videoList|length > 1 %}
            <div class="part">
                <div class="part-title"><h3>分段列表</h3>
                    <p>共{{ RAW.videoList|length }}P, 当前正在播放<span class="current-priority">{{ partNum }}</span>P</p></div>
                <div class="fl part-wrap">
                    <ul class="scroll-div">
                        {% for part in RAW.videoList %}
                        <li class="single-p{% if loop.index == partNum %} active{% endif %}"
                            data-href="ac{{ RAW.dougaId }}{{ "_"+loop.index|string if loop.index > 1 else "" }}.html"
                            title="{{ part.title }}" data-id="{{ part.id }}">{{ part.title }}</li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
            {% endif %}
            <div id="pagelet_newrecommend" style="visibility: visible;">
                <div class="recmd">
                    <h2 class="recommend-title">最新保存</h2>
                    <div class="clearfix area recommendation" id="recommends">

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% include 'parts/toolbar.html' %}
{% include 'parts/footer.html' %}
<script type="text/javascript">
    document.querySelector(".danmaku-fold").addEventListener('click', function (ev) {
        let father = document.querySelector(".danmaku-wrapper"),
            leftC = document.querySelector(".left-column"),
            rightC = document.querySelector(".right-column");
        [this, father, leftC, rightC].forEach(function (item) {
            item.classList.toggle('unfold');
        })
    });
    {% if RAW.videoList|length > 1 %}
    document.querySelectorAll(".part-wrap .single-p").forEach(function (item) {
        item.addEventListener('click', function (ev) {
            window.location.href = item.getAttribute('data-href');
        });
    });
    {% endif %}
    const copyText = (text) => navigator.clipboard?.writeText && navigator.clipboard.writeText(text)
    function goTo(domId) {
        let aTag = document.createElement('a');
        aTag.setAttribute('href', '#'+domId);
        aTag.click();
    }
    function addRecommend(data) {
        let base = document.createElement('figure'),
            leftS = document.createElement('a'),
            info = document.createElement('div'),
            viewC = document.createElement('span'),
            commC = document.createElement('span'),
            cover = document.createElement('img'),
            rightS = document.createElement('figure'),
            h3 = document.createElement('h3'),
            title = document.createElement('a'),
            up = document.createElement('a');
        base.setAttribute('class', 'fl block-box block-video no-animate auto-recommend block-show');
        leftS.setAttribute('class', 'block-img has-danmu');
        leftS.setAttribute('target', '_self');
        leftS.setAttribute('href', '../ac'+data.dougaId+'/ac'+data.dougaId+'.html');
        info.setAttribute('class', 'action-data');
        viewC.setAttribute('class', 'viewCount');
        viewC.innerHTML = data.viewCountShow;
        info.append(viewC);
        commC.setAttribute('class', 'commentCount');
        commC.innerHTML = data.commentCountShow;
        info.append(commC);
        leftS.append(info);
        cover.setAttribute('src', '../ac'+data.dougaId+'/cover._');
        leftS.append(cover);
        rightS.setAttribute('class', 'block-title');
        title.setAttribute('title', data.title);
        title.setAttribute('target', '_self');
        title.setAttribute('href', '../ac'+data.dougaId+'/ac'+data.dougaId+'.html');
        title.innerHTML = data.title;
        h3.append(title);
        rightS.append(h3);
        up.setAttribute('class', 'uper-name');
        up.setAttribute('target', '_blank');
        up.setAttribute('href', 'https://www.acfun.cn/u/'+data.user.id);
        up.innerHTML = "UP：" + data.user.name;
        rightS.append(up);
        base.append(leftS);
        base.append(rightS);
        document.getElementById('recommends').append(base);
    }
    function loadJs(path, callback) {
        let script = document.createElement('script');
        script.setAttribute('type', 'text/javascript');
        script.setAttribute('src', path);
        if (script.readyState) {  // only required for IE <9
            script.onreadystatechange = function () {
                if (script.readyState === "loaded" || script.readyState === "complete") {
                    script.onreadystatechange = null;
                    callback();
                }
            };
        } else {  //Others
            script.onload = function () {
                callback();
            };
        }
        document.body.append(script);
    }
</script>
<script type="text/javascript">
    let sourceId = "ac{{ v_num }}", videos = {}, videoLast = [], commentData=[];
</script>
<script type="text/javascript" src="../../member/{{ RAW.user.id }}.js"></script>
<script type="text/javascript" src="data/ac{{ v_num }}.js"></script>
<script type="text/javascript" src="data/ac{{ v_num }}.danmaku.js"></script>
<script type="text/javascript" src="data/ac{{ RAW.dougaId }}.comment.1.js"></script>
<script type="text/javascript" src="../leatest.js"></script>
<script type="text/javascript" src="../nums.js"></script>
<script type="text/javascript">
    let videoData = videos["ac{{ v_num }}"],
        danmakuData = ac{{ v_num }}_danmaku,
        commentCount = {{ RAW.commentCountRealValue }};
    videoLast.forEach(function (acNum) {
        if(acNum!==sourceId){
            loadJs('../'+acNum+'/data/'+acNum+'.js', function () {
                addRecommend(videos[acNum]);
            });
        }
    });
</script>
<script type="text/javascript" src="../../assets/js/localplayer.js"></script>
<script type="text/javascript" src="../../assets/js/danmakuList.js"></script>
<script type="text/javascript" src="../../assets/js/comment.js"></script>
</body>
</html>
