Compare commits

..

4 commits

Author SHA1 Message Date
veselcraft
4109dfe8c3
Posts: Fix poll display in microblog posts 2023-01-21 16:51:49 +03:00
celestora
089c805038 Merge branch 'textarea-refactor' of https://github.com/openvk/openvk into textarea-refactor 2023-01-21 15:00:35 +02:00
celestora
ccdf3c7861 Kinda fix poll display in non-microblog posts 2023-01-21 14:59:09 +02:00
celestora
d8e0995962 Fix funny typos xddd 2023-01-21 14:48:25 +02:00
5 changed files with 26 additions and 9 deletions

View file

@ -44,7 +44,7 @@ trait TAttachmentHost
continue; continue;
} }
$skipped[] = ["100%", "unset", $child, "unset"]; $skipped[] = $child;
} }
$height = "unset"; $height = "unset";
@ -66,7 +66,8 @@ trait TAttachmentHost
return (object) [ return (object) [
"width" => $width . "px", "width" => $width . "px",
"height" => $height . "px", "height" => $height . "px",
"tiles" => array_merge($result, $skipped), "tiles" => $result,
"extras" => $skipped,
]; ];
} }

View file

@ -68,11 +68,17 @@
{var $width = $width - 70 * $GLOBALS["_nesAttGloCou"]} {var $width = $width - 70 * $GLOBALS["_nesAttGloCou"]}
{/if} {/if}
{var $attachmentsLayout = $post->getChildrenWithLayout($width)} {var $attachmentsLayout = $post->getChildrenWithLayout($width)}
<div n:ifcontent class="attachments_b" style="height: {$attachmentsLayout->height|noescape}; width: {$attachmentsLayout->width|noescape};"> <div n:ifcontent class="attachments attachments_b" style="height: {$attachmentsLayout->height|noescape}; width: {$attachmentsLayout->width|noescape};">
<div class="attachment" n:foreach="$attachmentsLayout->tiles as $attachment" style="float: {$attachment[3]|noescape}; width: {$attachment[0]|noescape}; height: {$attachment[1]|noescape};" data-localized-nsfw-text="{_nsfw_warning}"> <div class="attachment" n:foreach="$attachmentsLayout->tiles as $attachment" style="float: {$attachment[3]|noescape}; width: {$attachment[0]|noescape}; height: {$attachment[1]|noescape};" data-localized-nsfw-text="{_nsfw_warning}">
{include "../attachment.xml", attachment => $attachment[2], post => $post} {include "../attachment.xml", attachment => $attachment[2], post => $post}
</div> </div>
</div> </div>
<div n:ifcontent class="attachments attachments_m">
<div class="attachment" n:foreach="$attachmentsLayout->extras as $attachment">
{include "../attachment.xml", attachment => $attachment, post => $post}
</div>
</div>
</div> </div>
<div n:if="$post->isAd()" style="color:grey;"> <div n:if="$post->isAd()" style="color:grey;">
<br/> <br/>

View file

@ -62,11 +62,17 @@
{var $width = $width - 70 * $GLOBALS["_nesAttGloCou"]} {var $width = $width - 70 * $GLOBALS["_nesAttGloCou"]}
{/if} {/if}
{var $attachmentsLayout = $post->getChildrenWithLayout($width)} {var $attachmentsLayout = $post->getChildrenWithLayout($width)}
<div n:ifcontent class="attachments_b" style="height: {$attachmentsLayout->height|noescape}; width: {$attachmentsLayout->width|noescape};"> <div n:ifcontent class="attachments attachments_b" style="height: {$attachmentsLayout->height|noescape}; width: {$attachmentsLayout->width|noescape};">
<div class="attachment" n:foreach="$attachmentsLayout->tiles as $attachment" style="float: {$attachment[3]|noescape}; width: {$attachment[0]|noescape}; height: {$attachment[1]|noescape};" data-localized-nsfw-text="{_nsfw_warning}"> <div class="attachment" n:foreach="$attachmentsLayout->tiles as $attachment" style="float: {$attachment[3]|noescape}; width: {$attachment[0]|noescape}; height: {$attachment[1]|noescape};" data-localized-nsfw-text="{_nsfw_warning}">
{include "../attachment.xml", attachment => $attachment[2], post => $post} {include "../attachment.xml", attachment => $attachment[2], post => $post}
</div> </div>
</div> </div>
<div n:ifcontent class="attachments attachments_m">
<div class="attachment" n:foreach="$attachmentsLayout->extras as $attachment">
{include "../attachment.xml", attachment => $attachment}
</div>
</div>
</div> </div>
<div n:if="$post->isAd()" style="color:grey;"> <div n:if="$post->isAd()" style="color:grey;">
<br/> <br/>

View file

@ -89,12 +89,12 @@ class Makima
($maxWidth - $marginWidth) / $ratios[1] / ( (1 / $ratios[0]) + (1 / $ratios[1]) ) ($maxWidth - $marginWidth) / $ratios[1] / ( (1 / $ratios[0]) + (1 / $ratios[1]) )
); );
$w1 = $maxWidth - $w0 - $marginWidth; $w1 = $maxWidth - $w0 - $marginWidth;
$h = min($maxHeight, min($w0 / $ratios[0], $w / $ratios[1])); $h = min($maxHeight, min($w0 / $ratios[0], $w1 / $ratios[1]));
$result->colSizes = [ceil($w0), ceil($w1)]; $result->colSizes = [ceil($w0), ceil($w1)];
$result->rowSizes = [1]; $result->rowSizes = [1];
$result->width = ceil($w0 + $w1 + $marginWidth); $result->width = ceil($w0 + $w1 + $marginWidth);
$result->height = ceil($height); $result->height = ceil($h);
$result->tiles = [new ThumbTile(1, 1, $w0, $h), new ThumbTile(1, 1, $w1, $h)]; $result->tiles = [new ThumbTile(1, 1, $w0, $h), new ThumbTile(1, 1, $w1, $h)];
} }
break; break;
@ -103,7 +103,7 @@ class Makima
if($orients == [Makima::ORIENT_WIDE, Makima::ORIENT_WIDE, Makima::ORIENT_WIDE]) { if($orients == [Makima::ORIENT_WIDE, Makima::ORIENT_WIDE, Makima::ORIENT_WIDE]) {
$hCover = min($maxWidth / $ratios[0], ($maxHeight - $marginHeight) * (2 / 3)); $hCover = min($maxWidth / $ratios[0], ($maxHeight - $marginHeight) * (2 / 3));
$w2 = ($maxWidth - $marginWidth) / 2; $w2 = ($maxWidth - $marginWidth) / 2;
$h = min($maxHeight - $hCover - $margin, min($w2 / $ratios[1], $w2 / $ratios[2])); $h = min($maxHeight - $hCover - $marginHeight, min($w2 / $ratios[1], $w2 / $ratios[2]));
$result->colSizes = [1, 1]; $result->colSizes = [1, 1];
$result->rowSizes = [ceil($hCover), ceil($h)]; $result->rowSizes = [ceil($hCover), ceil($h)];
@ -269,7 +269,7 @@ class Makima
$result->tiles[$k++] = $row[] = $tile; $result->tiles[$k++] = $row[] = $tile;
} }
$result->rowTiles[] = $row; $rowTiles[] = $row;
} }
sort($gridLineOffsets, SORT_NUMERIC); sort($gridLineOffsets, SORT_NUMERIC);

View file

@ -729,10 +729,14 @@ h4 {
line-height: 130%; line-height: 130%;
} }
.post-content .attachments_b { .post-content .attachments:first-of-type {
margin-top: 8px; margin-top: 8px;
} }
.post-content .attachments_m .attachment {
width: 98%;
}
.attachment .post { .attachment .post {
width: 102%; width: 102%;
} }