mirror of
https://github.com/openvk/openvk
synced 2025-05-13 20:46:41 +03:00
Fiks fotos viver four coments.
This commit is contained in:
parent
f0490bd05e
commit
ed49596674
7 changed files with 21 additions and 14 deletions
|
@ -11,7 +11,7 @@ class Comment extends Post
|
||||||
|
|
||||||
function getPrettyId(): string
|
function getPrettyId(): string
|
||||||
{
|
{
|
||||||
return $this->getRecord()->id;
|
return (string)$this->getRecord()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVirtualId(): int
|
function getVirtualId(): int
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
namespace openvk\Web\Presenters;
|
namespace openvk\Web\Presenters;
|
||||||
use openvk\Web\Models\Repositories\Posts;
|
use openvk\Web\Models\Repositories\{Posts, Comments};
|
||||||
use MessagePack\MessagePack;
|
use MessagePack\MessagePack;
|
||||||
use Chandler\Session\Session;
|
use Chandler\Session\Session;
|
||||||
|
|
||||||
|
@ -102,8 +102,13 @@ final class InternalAPIPresenter extends OpenVKPresenter
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
header("HTTP/1.1 405 Method Not Allowed");
|
||||||
exit("иди нахуй заебал");
|
exit("иди нахуй заебал");
|
||||||
}
|
}
|
||||||
|
|
||||||
$post = (new Posts)->getPostById($owner_id, $post_id);
|
if($this->postParam("parentType", false) == "post") {
|
||||||
|
$post = (new Posts)->getPostById($owner_id, $post_id);
|
||||||
|
} else {
|
||||||
|
$post = (new Comments)->get($post_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(is_null($post)) {
|
if(is_null($post)) {
|
||||||
$this->returnJson([
|
$this->returnJson([
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{if $attachment instanceof \openvk\Web\Models\Entities\Photo}
|
{if $attachment instanceof \openvk\Web\Models\Entities\Photo}
|
||||||
{if !$attachment->isDeleted()}
|
{if !$attachment->isDeleted()}
|
||||||
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
|
{var $link = "/photo" . ($attachment->isAnonymous() ? ("s/" . base_convert((string) $attachment->getId(), 10, 32)) : $attachment->getPrettyId())}
|
||||||
<a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('normal')}, {$post->getPrettyId()}, {$attachment->getPrettyId()})">
|
<a href="{$link}" onclick="OpenMiniature(event, {$attachment->getURLBySizeId('normal')}, {$parent->getPrettyId()}, {$attachment->getPrettyId()}, {$parentType})">
|
||||||
<img class="media media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" />
|
<img class="media media_makima" src="{$attachment->getURLBySizeId('normal')}" alt="{$attachment->getDescription()}" />
|
||||||
</a>
|
</a>
|
||||||
{else}
|
{else}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<div n:ifcontent class="attachments_b">
|
<div n:ifcontent class="attachments_b">
|
||||||
<div class="attachment" n:foreach="$comment->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
<div class="attachment" n:foreach="$comment->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
|
||||||
{include "attachment.xml", attachment => $attachment}
|
{include "attachment.xml", attachment => $attachment, parent => $comment, parentType => "comment"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
{var $attachmentsLayout = $post->getChildrenWithLayout($width)}
|
{var $attachmentsLayout = $post->getChildrenWithLayout($width)}
|
||||||
<div n:ifcontent class="attachments 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], parent => $post, parentType => "post"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
{var $attachmentsLayout = $post->getChildrenWithLayout($width)}
|
{var $attachmentsLayout = $post->getChildrenWithLayout($width)}
|
||||||
<div n:ifcontent class="attachments 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], parent => $post, parentType => "post"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ function removePicture(idA) {
|
||||||
u(`div#aP${idA}`).nodes[0].remove();
|
u(`div#aP${idA}`).nodes[0].remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function OpenMiniature(e, photo, post, photo_id) {
|
function OpenMiniature(e, photo, post, photo_id, type = "post") {
|
||||||
/*
|
/*
|
||||||
костыли но смешные однако
|
костыли но смешные однако
|
||||||
*/
|
*/
|
||||||
|
@ -275,7 +275,9 @@ function OpenMiniature(e, photo, post, photo_id) {
|
||||||
__slidePhoto(1);
|
__slidePhoto(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
ky.post("/iapi/getPhotosFromPost/" + post, {
|
let data = new FormData()
|
||||||
|
data.append('parentType', type);
|
||||||
|
ky.post("/iapi/getPhotosFromPost/" + (type == "post" ? post : "1_"+post), {
|
||||||
hooks: {
|
hooks: {
|
||||||
afterResponse: [
|
afterResponse: [
|
||||||
async (_request, _options, response) => {
|
async (_request, _options, response) => {
|
||||||
|
@ -297,7 +299,8 @@ function OpenMiniature(e, photo, post, photo_id) {
|
||||||
__reloadTitleBar();
|
__reloadTitleBar();
|
||||||
__loadDetails(json.body[imagesIndex - 1].id, imagesIndex); }
|
__loadDetails(json.body[imagesIndex - 1].id, imagesIndex); }
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
body: data
|
||||||
});
|
});
|
||||||
|
|
||||||
return u(".ovk-photo-view-dimmer");
|
return u(".ovk-photo-view-dimmer");
|
||||||
|
@ -753,7 +756,6 @@ $(document).on("click", "#photosAttachments", async (e) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(".photosInsert h4").innerHTML = tr("is_x_photos", photos.count)
|
document.querySelector(".photosInsert h4").innerHTML = tr("is_x_photos", photos.count)
|
||||||
console.log(photos)
|
|
||||||
|
|
||||||
let pagesCount = Math.ceil(Number(photos.count) / 24)
|
let pagesCount = Math.ceil(Number(photos.count) / 24)
|
||||||
u("#loader").remove()
|
u("#loader").remove()
|
||||||
|
@ -772,7 +774,7 @@ $(document).on("click", "#photosAttachments", async (e) => {
|
||||||
|
|
||||||
if(page < pagesCount) {
|
if(page < pagesCount) {
|
||||||
insertPlace.insertAdjacentHTML("beforeend", `
|
insertPlace.insertAdjacentHTML("beforeend", `
|
||||||
<div id="showMorePhotos" data-pagesCount="${pagesCount}" data-page="${page + 1}" style="width: 100%;text-align: center;background: #d5d5d5;height: 22px;padding-top: 9px;cursor:pointer;">
|
<div id="showMorePhotos" data-pagesCount="${pagesCount}" data-page="${page + 1}" style="width: 100%;text-align: center;background: #f0f0f0;height: 22px;padding-top: 9px;cursor:pointer;">
|
||||||
<span>more...</span>
|
<span>more...</span>
|
||||||
</div>`)
|
</div>`)
|
||||||
}
|
}
|
||||||
|
@ -790,7 +792,7 @@ $(document).on("click", "#photosAttachments", async (e) => {
|
||||||
|
|
||||||
$(".photosInsert").on("click", "#showMorePhotos", (e) => {
|
$(".photosInsert").on("click", "#showMorePhotos", (e) => {
|
||||||
u(e.currentTarget).remove()
|
u(e.currentTarget).remove()
|
||||||
insertPhotos(Number(e.currentTarget.dataset.page))
|
insertPhotos(Number(e.currentTarget.dataset.page), document.querySelector(".topGrayBlock #albumSelect").value)
|
||||||
})
|
})
|
||||||
|
|
||||||
$(".topGrayBlock #albumSelect").on("change", (evv) => {
|
$(".topGrayBlock #albumSelect").on("change", (evv) => {
|
||||||
|
|
Loading…
Reference in a new issue