-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.tmpl
125 lines (108 loc) · 3 KB
/
page.tmpl
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/macy@2"></script>
</head>
<style>
.item {
word-break: break-all;
border: 1px solid black;
}
pre {
white-space: pre-wrap;
color: gray;
margin: 0px;
}
.grayspan {
padding: 1px;
border-radius: 2px;
background-color: #f2f2f2;
margin: 1px;
border: 1px solid gray;
}
.grayspan:hover {
background-color: #e6e6e6;
position: relative;
}
.grayspan .contents {
display: none;
position: absolute;
background-color: #e6e6e6;
padding: 1px;
border-radius: 5px;
top: 100%;
left: 50%;
transform: translateX(-50%);
color: gray;
}
.grayspan:hover .contents {
display: block;
}
.title {
font-size: 16px;
font-weight: 500;
color: black;
}
a {
color: inherit;
text-decoration: none;
}
</style>
<body>
<!-- Toggle button -->
<button id="toggle-button">Toggle</button>
<!-- masonry layout -->
<div id="macy-container" style="display:none">
{{ range .Files }}
<div class="item">
<div class="title">{{ .Name }}</div>
<pre>{{ .Contents }}</pre>
</div>
{{ end }}
</div>
<div class="grayspan-container">
{{ range .Files }}
<span class="grayspan">
<!-- disable the default style of a tag -->
<a href="nvalt://find/{{.Name}}/"><span>{{ .Name }}</span></a>
<pre class="contents">{{ .Contents }}</pre>
</span>
{{ end }}
</div>
<script>
var macy = Macy({
container: '#macy-container',
trueOrder: false,
waitForImages: false,
margin: 5,
columns: 10,
breakAt: {
1200: 5,
940: 3,
520: 2,
400: 1
}
});
var toggleButton = document.getElementById("toggle-button");
toggleButton.addEventListener("click", function () {
var grayspan_container = document.getElementsByClassName("grayspan-container");
if (grayspan_container[0].style.display === "none") {
grayspan_container[0].style.display = "block";
} else {
grayspan_container[0].style.display = "none";
}
var macy_container = document.getElementById("macy-container");
if (macy_container.style.display === "none") {
macy_container.style.display = "block";
macy.recalculate(true, true);
} else {
macy_container.style.display = "none";
}
});
</script>
</body>
</html>