fossbook 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/init.js +1 -1
- package/package.json +1 -1
- package/themes/archie/assets/styles/main.css +46 -3
- package/themes/archie/layouts/post.html +45 -7
package/README.md
CHANGED
package/lib/init.js
CHANGED
|
@@ -130,7 +130,7 @@ function initProject(options = {}) {
|
|
|
130
130
|
// fossbook.config.ko.js, and so on. Menu labels can also be localized with
|
|
131
131
|
// homeLabel, allPostsLabel, aboutLabel, tagsLabel, allTagsLabel,
|
|
132
132
|
// postedOnLabel, readMoreLabel, previousPageLabel, nextPageLabel,
|
|
133
|
-
// and
|
|
133
|
+
// transcriptLabel, copyLinkLabel, linkCopiedLabel, and copyLinkErrorLabel.
|
|
134
134
|
|
|
135
135
|
// Comment system (optional)
|
|
136
136
|
// comments: { provider: "utterances", repo: "user/repo", issueTerm: "pathname", theme: "github-light" },
|
package/package.json
CHANGED
|
@@ -69,12 +69,38 @@
|
|
|
69
69
|
width: var(--dialogue-width, 100%);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.
|
|
72
|
+
.post-controls {
|
|
73
|
+
align-items: center;
|
|
73
74
|
display: flex;
|
|
75
|
+
flex-wrap: wrap;
|
|
76
|
+
gap: 1rem;
|
|
74
77
|
justify-content: flex-end;
|
|
75
78
|
margin: .75rem 0 1.5rem;
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
.copy-link-button {
|
|
82
|
+
background: transparent;
|
|
83
|
+
border: 1px solid var(--bordercl);
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
color: inherit;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
font: inherit;
|
|
88
|
+
font-size: .78rem;
|
|
89
|
+
line-height: 1.2;
|
|
90
|
+
min-height: 1.75rem;
|
|
91
|
+
padding: .15rem .4rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.copy-link-button:hover {
|
|
95
|
+
background: var(--hovercolor);
|
|
96
|
+
color: #fff;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.copy-link-button:focus-visible {
|
|
100
|
+
outline: 2px solid var(--hovercolor);
|
|
101
|
+
outline-offset: 2px;
|
|
102
|
+
}
|
|
103
|
+
|
|
78
104
|
.transcript-toggle {
|
|
79
105
|
align-items: center;
|
|
80
106
|
display: inline-flex;
|
|
@@ -124,7 +150,16 @@
|
|
|
124
150
|
}
|
|
125
151
|
|
|
126
152
|
.transcripts-hidden .image-dialogue {
|
|
127
|
-
|
|
153
|
+
border: 0;
|
|
154
|
+
clip: rect(0 0 0 0);
|
|
155
|
+
clip-path: inset(50%);
|
|
156
|
+
height: 1px;
|
|
157
|
+
margin: -1px;
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
padding: 0;
|
|
160
|
+
position: absolute !important;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
width: 1px;
|
|
128
163
|
}
|
|
129
164
|
|
|
130
165
|
|
|
@@ -152,12 +187,20 @@
|
|
|
152
187
|
}
|
|
153
188
|
|
|
154
189
|
@media print {
|
|
155
|
-
.
|
|
190
|
+
.post-controls {
|
|
156
191
|
display: none;
|
|
157
192
|
}
|
|
158
193
|
|
|
159
194
|
.transcripts-hidden .image-dialogue {
|
|
160
195
|
display: flex;
|
|
196
|
+
clip: auto;
|
|
197
|
+
clip-path: none;
|
|
198
|
+
height: auto;
|
|
199
|
+
margin: 0 auto;
|
|
200
|
+
overflow: visible;
|
|
201
|
+
position: static !important;
|
|
202
|
+
white-space: normal;
|
|
203
|
+
width: var(--dialogue-width, 100%);
|
|
161
204
|
}
|
|
162
205
|
}
|
|
163
206
|
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
|
|
30
30
|
${page.twitterCard("summary")}
|
|
31
31
|
${page.body.includes('class="blockquote-container image-dialogue"') ? `<script>
|
|
32
|
+
document.documentElement.classList.add("transcripts-hidden");
|
|
32
33
|
try {
|
|
33
|
-
if (localStorage.getItem("fossbook-comic-transcript") === "
|
|
34
|
-
document.documentElement.classList.
|
|
34
|
+
if (localStorage.getItem("fossbook-comic-transcript") === "visible") {
|
|
35
|
+
document.documentElement.classList.remove("transcripts-hidden");
|
|
35
36
|
}
|
|
36
37
|
} catch (error) {}
|
|
37
38
|
</script>` : ""}
|
|
@@ -56,12 +57,15 @@
|
|
|
56
57
|
<div class="meta">${page.config.postedOnLabel || "Posted on"} ${page.formatDate(new Date(page.date))}</div>
|
|
57
58
|
${page.languageSwitcher()}
|
|
58
59
|
</div>
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
<div class="post-controls">
|
|
61
|
+
${page.body.includes('class="blockquote-container image-dialogue"') ? `<div class="transcript-toggle">
|
|
61
62
|
<label for="comic-transcript-toggle">${page.config.transcriptLabel || "Display dialogue text"}</label>
|
|
62
|
-
<input id="comic-transcript-toggle" type="checkbox" role="switch" aria-controls="comic-transcript"
|
|
63
|
-
</div
|
|
64
|
-
|
|
63
|
+
<input id="comic-transcript-toggle" type="checkbox" role="switch" aria-controls="comic-transcript">
|
|
64
|
+
</div>` : ""}
|
|
65
|
+
<button class="copy-link-button" type="button">
|
|
66
|
+
<span aria-live="polite">${page.config.copyLinkLabel || "Copy link"}</span>
|
|
67
|
+
</button>
|
|
68
|
+
</div>
|
|
65
69
|
<section class="body" id="comic-transcript">
|
|
66
70
|
${page.body}
|
|
67
71
|
</section>
|
|
@@ -100,6 +104,40 @@
|
|
|
100
104
|
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
|
|
101
105
|
mermaid.initialize({ startOnLoad: true });
|
|
102
106
|
</script>` : ""}
|
|
107
|
+
<script>
|
|
108
|
+
const copyLinkButton = document.querySelector(".copy-link-button");
|
|
109
|
+
const copyLinkLabel = copyLinkButton.querySelector("span");
|
|
110
|
+
const defaultCopyLinkLabel = copyLinkLabel.textContent;
|
|
111
|
+
let copyLinkResetTimer;
|
|
112
|
+
const copyEpisodeLink = async () => {
|
|
113
|
+
const canonicalLink = document.querySelector('link[rel="canonical"]');
|
|
114
|
+
const episodeUrl = canonicalLink ? canonicalLink.href : window.location.href;
|
|
115
|
+
try {
|
|
116
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
117
|
+
await navigator.clipboard.writeText(episodeUrl);
|
|
118
|
+
} else {
|
|
119
|
+
const textArea = document.createElement("textarea");
|
|
120
|
+
textArea.value = episodeUrl;
|
|
121
|
+
textArea.setAttribute("readonly", "");
|
|
122
|
+
textArea.style.position = "fixed";
|
|
123
|
+
textArea.style.opacity = "0";
|
|
124
|
+
document.body.appendChild(textArea);
|
|
125
|
+
textArea.select();
|
|
126
|
+
const copied = document.execCommand("copy");
|
|
127
|
+
textArea.remove();
|
|
128
|
+
if (!copied) throw new Error("Copy command failed");
|
|
129
|
+
}
|
|
130
|
+
copyLinkLabel.textContent = ${JSON.stringify(page.config.linkCopiedLabel || "Link copied")};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
copyLinkLabel.textContent = ${JSON.stringify(page.config.copyLinkErrorLabel || "Could not copy link")};
|
|
133
|
+
}
|
|
134
|
+
clearTimeout(copyLinkResetTimer);
|
|
135
|
+
copyLinkResetTimer = setTimeout(() => {
|
|
136
|
+
copyLinkLabel.textContent = defaultCopyLinkLabel;
|
|
137
|
+
}, 2000);
|
|
138
|
+
};
|
|
139
|
+
copyLinkButton.addEventListener("click", copyEpisodeLink);
|
|
140
|
+
</script>
|
|
103
141
|
${page.body.includes('class="blockquote-container image-dialogue"') ? `<script>
|
|
104
142
|
const transcriptToggle = document.querySelector("#comic-transcript-toggle");
|
|
105
143
|
const transcriptStorageKey = "fossbook-comic-transcript";
|