-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
149 lines (133 loc) · 3.78 KB
/
index.html
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<html>
<head>
<title>webring-widget</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
:root {
--webring-widget-gap: 1rem;
}
widget,
links {
width: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
widget {
--link-color: blue;
height: 100%;
flex-direction: column;
}
links {
flex-direction: row;
}
a {
color: var(--link-color) !important;
text-decoration: none;
font-weight: bold;
}
#current {
position: relative;
}
.anchored {
position: absolute;
top: 0;
}
#previous.anchored {
right: calc(100% + var(--webring-widget-gap));
}
#next.anchored {
left: calc(100% + var(--webring-widget-gap));
}
</style>
<style>
@font-face {
font-family: "DotGothic16";
font-style: normal;
font-weight: 400;
src: url(./fonts/DotGothic16-Regular.ttf) format("truetype");
}
@font-face {
font-family: "Kosugi Maru";
font-style: normal;
font-weight: 400;
src: url(./fonts/KosugiMaru-Regular.ttf) format("truetype");
}
@font-face {
font-family: "Mochiy Pop P One";
font-style: normal;
font-weight: 400;
src: url(./fonts/MochiyPopPOne-Regular.ttf) format("truetype");
}
@font-face {
font-family: "Rampart One";
font-style: normal;
font-weight: 400;
src: url(./fonts/RampartOne-Regular.ttf) format("truetype");
}
</style>
</head>
<body>
<widget>
<span id="title">AMV Sashimi Webring</span>
<links>
<span id="current">
<a href="" target="_top" class="anchored" id="previous" alt="previous"
>←</a
>
<a href="" target="_top" class="anchored" id="next" alt="next">→</a>
</span>
</links>
</widget>
<script type="module" defer>
import {
localParams,
sites,
nextSite,
previousSite,
} from "./scripts/common.js";
const loc = document.location.search;
const params = new URLSearchParams(loc);
const suppress = params.get("suppress");
if (!suppress) {
console.info(
"Using the iframe webring-widget is not recommended, see https://github.com/reisir/webring-widget for instructions on using the new script based widget. If your host doesn't allow scripts, you can continue to use the iframe widget."
);
console.info("Add ?suppress=true to suppress these messages.");
}
// Get widget elements
const $widget = document.getElementsByTagName("widget")[0];
const $current = document.getElementById("current");
const $previous = document.getElementById("previous");
const $next = document.getElementById("next");
const $title = document.getElementById("title");
// Override widget styles
{
for (const key of localParams.keys()) {
$widget.style.setProperty(key, localParams.get(key));
}
}
// Allow widget title overrides
{
const title = localParams.get("title");
if (!title) {
} else {
if (title == 0 || title == "false") $title.remove();
else $title.textContent = title;
}
}
// Set middle item text
{
$current.prepend(sites.current?.title);
}
// Set previous and next href from sites
{
const previous = sites.previous();
$previous.href = previous.url;
const next = sites.next();
$next.href = next.url;
}
</script>
</body>
</html>