Fix game/study embeds on mobile in forum

pull/9455/head
Benedikt Werner 2021-07-24 10:03:02 +02:00
parent 2873bd8da5
commit 816a6fa4ec
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
6 changed files with 20 additions and 2 deletions

View File

@ -19,7 +19,7 @@
grid-template-columns: auto;
grid-template-rows: 100vw minmax(150px, calc(100vh - 100vw - 5.5rem)) 3rem;
@include breakpoint(min-width 400px) {
@media (min-width: 400px) and (min-aspect-ratio: 1/1) {
grid-template-columns: minmax(200px, calc(100vh - 2.5rem)) minmax(200px, 1fr);
grid-template-rows: auto 2.5rem;
grid-template-areas: 'board tools' 'board controls';

View File

@ -206,6 +206,12 @@
}
}
%game-embed {
@include breakpoint($mq-not-xx-small) {
padding-bottom: 160%;
}
}
%data-icon {
font-size: 1.2em;
vertical-align: middle;

View File

@ -103,6 +103,10 @@
.embed {
@extend %video;
&--game {
@extend %game-embed;
}
&.not-found {
height: 100px;
padding: 0;

View File

@ -131,6 +131,10 @@
.embed {
@extend %video;
&--game {
@extend %game-embed;
}
margin: $block-gap auto;
}
}

View File

@ -89,6 +89,10 @@
@extend %video;
margin: $block-gap auto;
.embed--game {
@extend %game-embed;
}
}
img {

View File

@ -93,7 +93,7 @@ lichess.load.then(() => {
const $iframe: any = $('<iframe>')
.addClass('analyse ' + a.type)
.attr('src', a.src);
$(a.element).replaceWith($('<div class="embed">').prepend($iframe));
$(a.element).replaceWith($('<div class="embed embed--game">').prepend($iframe));
return $iframe
.on('load', function (this: HTMLIFrameElement) {
if (this.contentDocument?.title.startsWith('404')) this.style.height = '100px';