Photo: The Fxck Is This implementation of comments under photo in viewer

This commit is contained in:
veselcraft 2022-12-15 16:40:00 +03:00
parent b898baeadb
commit 33997ce81f
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2 changed files with 22 additions and 2 deletions

View file

@ -26,7 +26,7 @@
<hr/> <hr/>
<div style="width: 100%; min-height: 100px;"> <div style="width: 100%; min-height: 100px;" class="ovk-photo-details">
<div style="float: left; min-height: 100px; width: 70%;"> <div style="float: left; min-height: 100px; width: 70%;">
{include "../components/comments.xml", comments => $comments, count => $cCount, page => $cPage, model => "photos", parent => $photo} {include "../components/comments.xml", comments => $comments, count => $cCount, page => $cPage, model => "photos", parent => $photo}
</div> </div>

View file

@ -188,8 +188,11 @@ function OpenMiniature(e, photo, post, photo_id) {
<center style="margin-bottom: 8pt;"> <center style="margin-bottom: 8pt;">
<div class="ovk-photo-slide-left"></div> <div class="ovk-photo-slide-left"></div>
<div class="ovk-photo-slide-right"></div> <div class="ovk-photo-slide-right"></div>
<img src="${photo}" style="max-width: 80%; max-height: 60vh;" id="ovk-photo-img"> <img src="${photo}" style="max-width: 100%; max-height: 60vh;" id="ovk-photo-img">
</center> </center>
<div class="ovk-photo-details">
<img src="/assets/packages/static/openvk/img/loading_mini.gif">
</div>
</div> </div>
</div>`); </div>`);
u("body").addClass("dimmed").append(dialog); u("body").addClass("dimmed").append(dialog);
@ -265,6 +268,23 @@ function OpenMiniature(e, photo, post, photo_id) {
} }
}); });
ky("/photo" + photo_id, {
hooks: {
afterResponse: [
async (_request, _options, response) => {
let parser = new DOMParser();
let body = parser.parseFromString(await response.text(), "text/html");
let element = u(body.getElementsByClassName("ovk-photo-details")).last();
u(".ovk-photo-details").last().innerHTML = element.innerHTML;
u("#photo_com_title_photos").last().innerHTML = "Фотография " + imagesIndex + " из " + imagesCount;
}
]
}
});
return u(".ovk-photo-view-dimmer"); return u(".ovk-photo-view-dimmer");
} }