Repository navigation
Expand file tree
/
Copy pathpublications.html
More file actions
84 lines (79 loc) · 3.83 KB
/
Copy pathpublications.html
File metadata and controls
84 lines (79 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
layout: default
title : Publications
navbar_title: Publications
body_attr: >-
data-spy="scroll" data-target="#navbar-year" data-offset="100"
---
{% assign pubs_by_year = site.publications | sort: "date" | reverse | group_by_exp: "item", "item.date | date: '%Y'" %}
<div class="row">
<div class="col-12 col-lg-10">
<div class="pub-timeline">
{% for year in pubs_by_year %}
{% assign num_papers = year.items | size %}
<section class="pub-year-section reveal">
<h2 class="pub-year-heading pt-4" id="year-{{ year.name }}">{{ year.name }}<span class="pub-year-count">{{ num_papers }} Publication{% if num_papers > 1 %}s{% endif %}</span></h2>
<div class="my-0 p-0 bg-white shadow-sm rounded-xl">
{% for item in year.items %}
{% include widgets/publication_item.html item=item hide_bottom_border=forloop.last first=forloop.first last=forloop.last %}
{% endfor %}
</div>
</section>
{% endfor %}
</div>
</div>
<div class="col-2 d-none d-lg-block">
<div id="navbar-year" class="nav nav-pills flex-column sticky-top" style="top: 80px">
{% for year in pubs_by_year %}
<a class="nav-link d-block" href="#year-{{ year.name }}">{{ year.name }}</a>
{% endfor %}
</div>
</div>
</div>
<script>
// 论文摘要 [show more] / [show less]:点击展开完整摘要,再次点击收起。
// 动效:用 max-height 过渡展示展开/收起过程(初末高度由 JS 实测,
// 基础截断仍靠 -webkit-line-clamp,行数不变);reduced-motion 时直接切换。
(function () {
var reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
document.querySelectorAll(".abstract-toggle").forEach(function (btn) {
var p = btn.parentElement.querySelector(".publication-abstract");
if (!p) return;
// 记录收起态(4 行截断)的渲染高度,作为收起动画的终点
if (!p.dataset.clampedH) {
p.dataset.clampedH = Math.round(p.getBoundingClientRect().height);
}
btn.addEventListener("click", function () {
var expanded = p.classList.contains("expanded");
if (reduced) {
p.classList.toggle("expanded");
btn.textContent = expanded ? "[+] expand" : "[−] collapse";
return;
}
// 过渡结束后清理内联 max-height,交还给 line-clamp/自然高度
var onEnd = function (e) {
if (e.propertyName !== "max-height") return;
p.style.maxHeight = "";
p.classList.remove("abstract-anim");
p.removeEventListener("transitionend", onEnd);
};
if (!expanded) {
p.dataset.clampedH = Math.round(p.getBoundingClientRect().height);
p.style.maxHeight = p.dataset.clampedH + "px";
p.classList.add("expanded", "abstract-anim");
void p.offsetHeight; // 先应用起始高度,再过渡到完整高度
p.style.maxHeight = p.scrollHeight + "px";
btn.textContent = "[−] collapse";
} else {
p.style.maxHeight = p.scrollHeight + "px";
p.classList.add("abstract-anim");
void p.offsetHeight;
p.classList.remove("expanded");
p.style.maxHeight = p.dataset.clampedH + "px";
btn.textContent = "[+] expand";
}
p.addEventListener("transitionend", onEnd);
});
});
})();
</script>