mirror of
https://gitlab.com/idotj/mastodon-embed-timeline.git
synced 2025-07-09 15:37:29 +00:00
Remove extra height on loading images + Fix spoiler btn
This commit is contained in:
parent
5026b894e6
commit
2a2c02c99f
@ -1,5 +1,7 @@
|
|||||||
v3.7.1 - 15/07/2023
|
v3.7.2 - 25/07/2023
|
||||||
- Use window.onload to take async attribute into account
|
- Use window.onload to take async attribute into account
|
||||||
|
- Remove extra height on loading images
|
||||||
|
- Fix interaction conflict with sensitive media and content warning
|
||||||
|
|
||||||
v3.7.0 - 10/07/2023
|
v3.7.0 - 10/07/2023
|
||||||
- Add Markdown to HTML feature
|
- Add Markdown to HTML feature
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Mastodon embed feed timeline v3.7.1 */
|
/* Mastodon embed feed timeline v3.7.2 */
|
||||||
/* More info at: */
|
/* More info at: */
|
||||||
/* https://gitlab.com/idotj/mastodon-embed-feed-timeline */
|
/* https://gitlab.com/idotj/mastodon-embed-feed-timeline */
|
||||||
|
|
||||||
@ -100,7 +100,6 @@ html[data-theme="dark"] {
|
|||||||
left: 5px;
|
left: 5px;
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
background-color: transparent;
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: 50% 50%;
|
background-position: 50% 50%;
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
@ -132,19 +131,8 @@ html[data-theme="dark"] {
|
|||||||
}
|
}
|
||||||
.toot-text .spoiler-link {
|
.toot-text .spoiler-link {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
border-radius: 2px;
|
|
||||||
background-color: var(--bg-hover-color);
|
|
||||||
border: 0;
|
|
||||||
color: var(--content-text);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 0.7rem;
|
|
||||||
padding: 0 0.35rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
line-height: 1.25rem;
|
|
||||||
cursor: pointer;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
}
|
||||||
.toot-text .spoiler-text {
|
.toot-text .spoiler-text-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.toot-text.truncate {
|
.toot-text.truncate {
|
||||||
@ -222,13 +210,8 @@ html[data-theme="dark"] {
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
:not(.toot-media-spoiler) > .spoiler-link {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot-media-spoiler > img {
|
.toot-media-spoiler > img {
|
||||||
filter: blur(2rem);
|
filter: blur(2rem);
|
||||||
}
|
}
|
||||||
@ -256,6 +239,21 @@ html[data-theme="dark"] {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Spoiler button */
|
||||||
|
.spoiler-link {
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: var(--line-gray-color);
|
||||||
|
border: 0;
|
||||||
|
color: var(--content-text);
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
padding: 0 0.35rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
cursor: pointer;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
/* Date */
|
/* Date */
|
||||||
.toot-date {
|
.toot-date {
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
@ -271,7 +269,6 @@ html[data-theme="dark"] {
|
|||||||
right: calc(50% - 1.5rem);
|
right: calc(50% - 1.5rem);
|
||||||
}
|
}
|
||||||
.loading-spinner {
|
.loading-spinner {
|
||||||
height: 100%;
|
|
||||||
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.0' viewBox='0 0 128 128' %3E%3Cg%3E%3Cpath d='M64 128A64 64 0 0 1 18.34 19.16L21.16 22a60 60 0 1 0 52.8-17.17l.62-3.95A64 64 0 0 1 64 128z' fill='%23404040'/%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 64 64' to='360 64 64' dur='1000ms' repeatCount='indefinite'%3E%3C/animateTransform%3E%3C/g%3E%3C/svg%3E");
|
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.0' viewBox='0 0 128 128' %3E%3Cg%3E%3Cpath d='M64 128A64 64 0 0 1 18.34 19.16L21.16 22a60 60 0 1 0 52.8-17.17l.62-3.95A64 64 0 0 1 64 128z' fill='%23404040'/%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 64 64' to='360 64 64' dur='1000ms' repeatCount='indefinite'%3E%3C/animateTransform%3E%3C/g%3E%3C/svg%3E");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Mastodon embed feed timeline v3.7.1
|
// Mastodon embed feed timeline v3.7.2
|
||||||
// More info at:
|
// More info at:
|
||||||
// https://gitlab.com/idotj/mastodon-embed-feed-timeline
|
// https://gitlab.com/idotj/mastodon-embed-feed-timeline
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ MastodonApi.prototype.getToots = function () {
|
|||||||
'<div class="toot-text">' +
|
'<div class="toot-text">' +
|
||||||
status_.spoiler_text +
|
status_.spoiler_text +
|
||||||
' <button type="button" class="spoiler-link" aria-expanded="false">Show more</button>' +
|
' <button type="button" class="spoiler-link" aria-expanded="false">Show more</button>' +
|
||||||
'<div class="spoiler-text">' +
|
'<div class="spoiler-text-hidden">' +
|
||||||
this.formatTootText(status_.content) +
|
this.formatTootText(status_.content) +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>";
|
"</div>";
|
||||||
@ -403,15 +403,25 @@ MastodonApi.prototype.getToots = function () {
|
|||||||
|
|
||||||
// Spoiler button
|
// Spoiler button
|
||||||
let toogleSpoiler = function (e) {
|
let toogleSpoiler = function (e) {
|
||||||
let spoilerText = e.target.nextSibling;
|
const nextSibling = e.target.nextSibling;
|
||||||
let spoilerBtnText = e.target.textContent;
|
if (nextSibling.localName === "img") {
|
||||||
spoilerText.classList.toggle("spoiler-text");
|
e.target.parentNode.classList.remove("toot-media-spoiler");
|
||||||
if (spoilerBtnText == "Show more") {
|
e.target.style.display = "none";
|
||||||
spoilerBtnText = "Show less";
|
} else if (
|
||||||
e.target.setAttribute("aria-expanded", "true");
|
nextSibling.classList.contains("spoiler-text-hidden") ||
|
||||||
} else {
|
nextSibling.classList.contains("spoiler-text-visible")
|
||||||
spoilerBtnText = "Show more";
|
) {
|
||||||
e.target.setAttribute("aria-expanded", "false");
|
if (e.target.textContent == "Show more") {
|
||||||
|
nextSibling.classList.remove("spoiler-text-hidden");
|
||||||
|
nextSibling.classList.add("spoiler-text-visible");
|
||||||
|
e.target.setAttribute("aria-expanded", "true");
|
||||||
|
e.target.textContent = "Show less";
|
||||||
|
} else {
|
||||||
|
nextSibling.classList.remove("spoiler-text-visible");
|
||||||
|
nextSibling.classList.add("spoiler-text-hidden");
|
||||||
|
e.target.setAttribute("aria-expanded", "false");
|
||||||
|
e.target.textContent = "Show more";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -470,9 +480,7 @@ MastodonApi.prototype.replaceMedias = function (m, s) {
|
|||||||
'<div class="toot-media ' +
|
'<div class="toot-media ' +
|
||||||
(spoiler ? "toot-media-spoiler" : "") +
|
(spoiler ? "toot-media-spoiler" : "") +
|
||||||
' img-ratio14_7 loading-spinner">' +
|
' img-ratio14_7 loading-spinner">' +
|
||||||
(spoiler
|
(spoiler ? '<button class="spoiler-link">Show content</button>' : "") +
|
||||||
? '<button class="spoiler-link" onclick="this.parentNode.classList.remove(\'toot-media-spoiler\')">Show content</button>'
|
|
||||||
: "") +
|
|
||||||
'<img onload="removeSpinner(this)" onerror="removeSpinner(this)" src="' +
|
'<img onload="removeSpinner(this)" onerror="removeSpinner(this)" src="' +
|
||||||
m.preview_url +
|
m.preview_url +
|
||||||
'" alt="" loading="lazy" />' +
|
'" alt="" loading="lazy" />' +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user