Copypaste

This commit is contained in:
lalka2016 2023-09-15 19:04:13 +03:00
parent 704148cfc3
commit b876782c24
3 changed files with 28 additions and 2 deletions

View file

@ -254,6 +254,9 @@ class Post extends Postable
if($this->isDeactivationMessage() || $this->isUpdateAvatarMessage()) if($this->isDeactivationMessage() || $this->isUpdateAvatarMessage())
return false; return false;
if($this->getTargetWall() > 0)
return $this->getPublicationTime()->timestamp() + WEEK > time();
return $user->getId() == $this->getOwner(false)->getId(); return $user->getId() == $this->getOwner(false)->getId();
} }

View file

@ -2,9 +2,13 @@
{block title}{_upload_photo}{/block} {block title}{_upload_photo}{/block}
{block header} {block header}
<a href="{$thisUser->getURL()}">{$thisUser->getCanonicalName()}</a> <a href="{$album->getOwner()->getURL()}">{$album->getOwner()->getCanonicalName()}</a>
» »
<a href="/albums{$thisUser->getId()}">{_albums}</a> {if $album->getOwner() instanceof openvk\Web\Models\Entities\Club}
<a href="/albums{$album->getOwner()->getId() * -1}">{_albums}</a>
{else}
<a href="/albums{$album->getOwner()->getId()}">{_albums}</a>
{/if}
» »
<a href="/album{$album->getPrettyId()}">{$album->getName()}</a> <a href="/album{$album->getPrettyId()}">{$album->getName()}</a>
» »

View file

@ -6,6 +6,18 @@ $(document).on("change", "#uploadButton", (e) => {
return; return;
} }
for(const file of e.currentTarget.files) {
if(!file.type.startsWith('image/')) {
MessageBox(tr("error"), tr("only_images_accepted", escapeHtml(file.name)), [tr("ok")], [() => {Function.noop}])
return;
}
if(file.size > 5 * 1024 * 1024) {
MessageBox(tr("error"), tr("max_filesize", 5), [tr("ok")], [() => {Function.noop}])
return;
}
}
if(document.querySelector(".whiteBox").style.display == "block") { if(document.querySelector(".whiteBox").style.display == "block") {
document.querySelector(".whiteBox").style.display = "none" document.querySelector(".whiteBox").style.display = "none"
document.querySelector(".insertThere").append(document.getElementById("fakeButton")); document.querySelector(".insertThere").append(document.getElementById("fakeButton"));
@ -177,3 +189,10 @@ $(".container_gray").on("drop", (e) => {
document.getElementById("uploadButton").files = files document.getElementById("uploadButton").files = files
u("#uploadButton").trigger("change") u("#uploadButton").trigger("change")
}) })
u(".container_gray").on("paste", (e) => {
if(e.clipboardData.files.length > 0 && e.clipboardData.files.length < 10) {
document.getElementById("uploadButton").files = e.clipboardData.files;
u("#uploadButton").trigger("change")
}
})