Update content of files

This commit is contained in:
GitHub Action 2021-12-15 15:48:14 +00:00
parent 91ac02eeb2
commit a7ff40c9be
2 changed files with 73 additions and 0 deletions

View file

@ -75,6 +75,60 @@ mark.label span.hidden {
letter-spacing: 12em;
pointer-events: none;
}
span.tg-spoiler {
--bg-transition: .1s ease;
--anim: .6s .1s ease;
padding: 1px 0;
border-radius: 1px;
}
.spoilers_animate span.tg-spoiler {
animation: blurred var(--anim);
transition: color var(--anim), background var(--bg-transition);
}
.spoilers_hidden span.tg-spoiler {
background: #ddd;
color: transparent;
cursor: pointer;
}
.widget_frame_base .spoilers_animate span.tg-spoiler a {
transition: color var(--anim);
}
span.tg-spoiler .emoji {
position: relative;
background-position: -1000px -1000px;
}
span.tg-spoiler .emoji:before {
content: '';
position: absolute;
pointer-events: none;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: inherit;
background-position: 2px 50%;
background-position-y: calc(50% - 1px);
opacity: 1;
}
.widget_frame_base .spoilers_hidden span.tg-spoiler a {
color: transparent;
pointer-events: none;
}
.emoji_image .spoilers_animate span.tg-spoiler .emoji:before {
transition: opacity var(--anim);
}
.emoji_image .spoilers_hidden span.tg-spoiler .emoji:before {
opacity: 0;
}
@-webkit-keyframes blurred {
from { filter: blur(2px); }
to { filter: blur(0); }
}
@keyframes blurred {
from { filter: blur(2px); }
to { filter: blur(0); }
}
.flex_ellipsis,
.inline_flex_ellipsis {
position: relative;

View file

@ -1284,6 +1284,13 @@ function checkFrameSize() {
}
}
}, postEl);
gec('.js-message_text', function() {
var spoilers = ge('span.tg-spoiler', this);
if (spoilers.length) {
addClass(this, 'spoilers_hidden');
addEvent(spoilers, 'click', TPost.eSpoilerShow);
}
}, postEl);
gec('.js-message_footer.compact', function() {
var timeEl = ge1('time[datetime]', this)
, textEl = this.previousElementSibling;
@ -1357,6 +1364,18 @@ function checkFrameSize() {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.send(null);
}
},
eSpoilerShow: function(e) {
var text_el = gpeByClass(this, 'js-message_text');
if (!text_el) {
return false;
}
e.preventDefault();
e.stopImmediatePropagation();
addClass(text_el, 'spoilers_animate');
removeClass(text_el, 'spoilers_hidden');
var spoilers = ge('span.tg-spoiler', text_el);
removeEvent(spoilers, 'click', TPost.eSpoilerShow);
}
};