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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
use maud::{html, Markup, PreEscaped};
use xesite_types::mastodon::{Toot, User};
pub fn talk_warning() -> Markup {
html! {
div.warning {
(conv("Cadey".to_string(), "coffee".to_string(), html!{
"So you are aware: you are reading the written version of a conference talk. This is written in a different style that is more lighthearted, conversational and different than the content normally on this blog. The words being said are the verbatim words that were spoken at the conference. The slides are the literal slides for each spoken utterance. If you want to hide the non-essential slides, please install this userstyle: "
a href="/css/no-fun-allowed.user.css" {code {"No fun allowed"}}
". If this isn't enough, please edit it to also hide this CSS class: "
code { "xeblog-slides-essential" }
". Doing this may make the presentation page harder to understand."
}))
}
}
}
pub fn slide(name: String, essential: bool) -> Markup {
html! {
div.hero.{@if essential {("xeblog-slides-essential")} @else {("xeblog-slides-fluff")}} {
picture style="margin:0" {
source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) ".avif"};
source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) ".webp"};
img style="padding:0" loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) "-smol.png"};
}
}
}
}
pub fn picture(path: String) -> Markup {
html! {
a href={"https://cdn.xeiaso.net/file/christine-static/" (path) ".jpg"} target="_blank" {
center {
picture style="margin:0" {
source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/" (path) ".avif"};
source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/" (path) ".webp"};
img style="padding:0" loading="lazy" alt={"hero image " (path)} src={"https://cdn.xeiaso.net/file/christine-static/" (path) "-smol.png"};
}
}
}
}
}
pub fn hero(file: String, prompt: Option<String>, ai: Option<String>) -> Markup {
let ai = ai.unwrap_or("MidJourney".to_string());
html! {
meta property="og:image" content={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"}
figure.hero style="margin:0" {
picture style="margin:0" {
source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".avif"};
source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".webp"};
img style="padding:0" loading="lazy" alt={"hero image " (file)} src={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"};
}
figcaption {
"Image generated by "
(ai)
@if let Some(prompt) = prompt { " -- " (prompt) }
}
}
}
}
pub fn conv(name: String, mood: String, body: Markup) -> Markup {
let name_lower = name.clone().to_lowercase();
let name = name.replace("_", " ");
html! {
.conversation {
."conversation-picture"."conversation-smol" {
picture {
source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"};
source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"};
img alt={(name) " is " (mood)} loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"};
}
}
."conversation-chat" {
"<"
b { (name) }
"> "
(body)
}
}
}
}
pub fn sticker(name: String, mood: String) -> Markup {
let name_lower = name.to_lowercase();
html! {
center {
picture {
source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"};
source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"};
img alt={(name) " is " (mood)} src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"};
}
}
}
}
pub fn video(path: String) -> Markup {
let stream_url = format!(
"https://cdn.xeiaso.net/file/christine-static/{}/index.m3u8",
path
);
let uuid = uuid::Uuid::new_v4();
let uuid = format!("{uuid}").replace("-", "");
let hls_script = PreEscaped(format!(
r#"
<script>
if (Hls.isSupported()) {{
let video = document.getElementById('{uuid}');
let hls = new Hls();
let videoSrc = "{}";
hls.on(Hls.Events.MEDIA_ATTACHED, function () {{
console.log('video and hls.js are now bound together !');
}});
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {{
console.log(
'manifest loaded, found ' + data.levels.length + ' quality level'
);
}});
hls.loadSource(videoSrc);
// bind them together
hls.attachMedia(video);
}} else if (video.canPlayType('application/vnd.apple.mpegurl')) {{
video.src = videoSrc;
}}
</script>
"#,
stream_url
));
html! {
script src="/static/js/hls.js" {}
noscript {
div.warning {
(conv("Mara".into(), "hacker".into(), PreEscaped("You may need to enable JavaScript for this to work. I'm a cartoon shark, not a cop.".to_string())))
}
}
video id=(uuid) width="100%" controls {
source src=(stream_url) r#type="application/vnd.apple.mpegurl";
source src="https://cdn.xeiaso.net/file/christine-static/blog/HLSBROKE.mp4" r#type="video/mp4";
}
(hls_script)
}
}
pub fn advertiser_nag() -> Markup {
html! {
script r#async src="https://media.ethicalads.io/media/client/ethicalads.min.js" { "" }
div.adaptive data-ea-publisher="christinewebsite" data-ea-type="text" data-ea-style="fixedfooter" {
.warning {
(conv(
"Cadey".into(),
"coffee".into(),
html! {
"Hello! Thank you for visiting my website. You seem to be using an ad-blocker. I understand why you do this, but I'd really appreciate if it you would turn it off for my website. These ads help pay for running the website and are done by "
a href="https://www.ethicalads.io/" { "Ethical Ads" }
". I do not receive detailed analytics on the ads and from what I understand neither does Ethical Ads. If you don't want to disable your ad blocker, please consider donating on "
a href="https://patreon.com/cadey" { "Patreon" }
" or sending some extra cash to "
code { "xeiaso.eth" }
" or "
code { "0xeA223Ca8968Ca59e0Bc79Ba331c2F6f636A3fB82" }
". It helps fund the website's hosting bills and pay for the expensive technical editor that I use for my longer articles. Thanks and be well!"
},
))
}
}
}
}
pub fn toot_embed(u: User, t: Toot) -> Markup {
let content = html! {
(PreEscaped::<String>(t.content))
@for att in &t.attachment {
@if att.media_type.starts_with("image/") {
a href=(att.url) {
img width="100%" height="100%" src=(att.url) alt=(att.name.clone().unwrap_or("no description provided".into()));
}
}
@if att.media_type.starts_with("video/") {
video width="100%" height="100%" controls {
source src=(att.url) type=(att.media_type);
"Your browser does not support the video tag, see this URL: "
a href=(att.url) {(att.url)}
}
}
}
@if t.attachment.len() != 0 {
br;
}
a href=(t.url.unwrap_or(t.id)) { "Link" }
};
html! {
.media {
.media-left {
.avatarholder {
img src=(u.icon.url) alt={"the profile picture for " (u.preferred_username)};
}
}
.media-body {
.media-heading {
(u.name)
@if u.id == "https://pony.social/users/cadey" {
img.verified src="https://cdn.xeiaso.net/file/christine-static/blog/verified.png";
}
" "
a href=(u.url) {"@" (u.preferred_username)}
br;
(t.published.format("M%m %d %Y %H:%M (UTC)").to_string())
}
.media-content {
@if let Some(warning) = t.summary {
details
|