{| extend("../base.html") |}

{| block content |}
<div class="wrapper">
    <a href="?kw={{ ctx.kw }}">首页</a>
    <a href="?kw={{ ctx.kw }}&o={= ctx.offset_prev =}" style="margin-left: 0.5em;">上一页</a>
    <a href="?kw={{ ctx.kw }}&o={= ctx.offset_next =}" style="margin-left: 0.5em;">下一页</a>
    <div class="vod">
        <div class="vod-title">标题</div>
        <div class="vod-head-class">类型</div>
        <div class="vod-memo"></div>
        <div class="vod-score">豆瓣</div>
        <div class="vod-updated">更新时间</div>
    </div>
    {[ for _, vod in ipairs(ctx.vods) do ]}
    <div class="vod">
        <div class="vod-title" title="{{ vod.title }}">
            <a href="/vod/detail/?id={= vod.id =}" target="_blank">{{ vod.title }}</a>
        </div>
        <div class="vod-class">{{ vod.class }}</div>
        <div class="vod-memo">{{ vod.memo }}</div>
        <div class="vod-score">
            {[ if vod.douban.id ~= '' then ]}
            <a href="https://www.douban.com/subject/{= vod.douban_id =}/"
                target="_blank">{{ vod.douban.score }}</a>
            {[ end ]}
        </div>
        <div class="vod-updated">{= to_datetime(vod.updated) =}</div>
    </div>
    {[ end ]}
    <a href="?kw={{ ctx.kw }}">首页</a>
    <a href="?kw={{ ctx.kw }}&o={= ctx.offset_prev =}" style="margin-left: 0.5em;">上一页</a>
    <a href="?kw={{ ctx.kw }}&o={= ctx.offset_next =}" style="margin-left: 0.5em;">下一页</a>
</div>
{| end block content |}

{| block style |}
<style>
    .vod:nth-of-type(2n) {
        background-color: #ddd;
    }

    .vod {
        display: flex;
        text-decoration: none;
        color: #000;
    }

    .vod-title {
        width: 18em;
        margin-right: 1em;
    }

    .vod-head-class {
        width: 6.4em;
    }

    .vod-class {
        width: 8em;
        font-size: 0.8em;
    }

    .vod-memo {
        width: 10em;
        font-size: 0.8em;
    }

    .vod-score {
        width: 4em;
        text-align: center;
    }

    .vod-updated {
        width: 12em;
    }
</style>
{| end block style |}

{| block script |}
<script>
    document.getElementById('search-input').value = '{= ctx.kw =}'
</script>
{| end block script |}
