网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
@model (bool IsFolder,List<ChildrenTree> Children)

@{
    var keyword = TempData["SearchKey"] as string;

    string MatchKeyword(string name)
    {
        if (string.IsNullOrEmpty(keyword))
            return name;

        var startIndex = name.IndexOf(keyword, StringComparison.CurrentCultureIgnoreCase);
        if (startIndex >= 0)
        {
            var match = name.Substring(startIndex, keyword.Length);
            return name[..startIndex] + $"<mark>{match}</mark>" + name[(startIndex + keyword.Length)..];
        }
        return name;
    }
}


@foreach (var item in Model.Children)
{
    <div class="row">
        <div class="icon">
            <partial name="_IconPartial" model="(Model.IsFolder,item.Name)"/>
        </div>
        <div class="header">
            <span>
                <a asp-action="Index" asp-route-path="@(string.Join("/", item.CurrentPath))" title="@item.Name">
                    @Html.Raw(MatchKeyword(item.Name))
                </a>
            </span>
        </div>
        <div class="desc">
            <span>
                <a title="@item.Note">@(item.Note)</a>
            </span>
        </div>
        <div class="time">
            <time class="timeago" datetime="@item.LastUpdateTime">@item.LastUpdateTime</time>
        </div>
    </div>
}
loading