- {$comment->getText()|noescape}
+ {$comment->getText()|noescape}
diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml
index c8cd2a12..6b0444c7 100644
--- a/Web/Presenters/templates/components/post/microblogpost.xml
+++ b/Web/Presenters/templates/components/post/microblogpost.xml
@@ -72,7 +72,7 @@
- {$post->getText()|noescape}
+ {$post->getText()|noescape}
diff --git a/Web/Presenters/templates/components/post/oldpost.xml b/Web/Presenters/templates/components/post/oldpost.xml
index ad7896f2..6e0b4c53 100644
--- a/Web/Presenters/templates/components/post/oldpost.xml
+++ b/Web/Presenters/templates/components/post/oldpost.xml
@@ -63,7 +63,7 @@
{var $owner = $author->getId()}
- {$post->getText()|noescape}
+ {$post->getText()|noescape}
diff --git a/Web/static/js/al_photos.js b/Web/static/js/al_photos.js
index 59965c09..b4632d60 100644
--- a/Web/static/js/al_photos.js
+++ b/Web/static/js/al_photos.js
@@ -6,6 +6,18 @@ $(document).on("change", "#uploadButton", (e) => {
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") {
document.querySelector(".whiteBox").style.display = "none"
document.querySelector(".insertThere").append(document.getElementById("fakeButton"));
@@ -142,23 +154,23 @@ $(document).on("dragover drop", (e) => {
return false;
})
-$(document).on("dragover", (e) => {
+$(".container_gray").on("dragover", (e) => {
e.preventDefault()
document.querySelector("#fakeButton").classList.add("dragged")
document.querySelector("#fakeButton").value = tr("drag_files_here")
})
-$(document).on("dragleave", (e) => {
+$(".container_gray").on("dragleave", (e) => {
e.preventDefault()
document.querySelector("#fakeButton").classList.remove("dragged")
document.querySelector("#fakeButton").value = tr("upload_picts")
})
-$("#fakeButton").on("drop", (e) => {
+$(".container_gray").on("drop", (e) => {
e.originalEvent.dataTransfer.dropEffect = 'move';
e.preventDefault()
- $(document).trigger("dragleave")
+ $(".container_gray").trigger("dragleave")
let files = e.originalEvent.dataTransfer.files
@@ -177,3 +189,10 @@ $("#fakeButton").on("drop", (e) => {
document.getElementById("uploadButton").files = files
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")
+ }
+})
diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js
index 9b54adce..4c8bb933 100644
--- a/Web/static/js/al_wall.js
+++ b/Web/static/js/al_wall.js
@@ -273,7 +273,7 @@ $(document).on("click", "#editPost", (e) => {
content.insertAdjacentHTML("afterbegin", `
-
+
@@ -343,6 +343,7 @@ $(document).on("click", "#editPost", (e) => {
post.querySelector(".post-avatar").setAttribute("src", result.author.avatar)
post.querySelector(".post-author-name").innerHTML = result.author.name
+ post.querySelector(".really_text").setAttribute("data-text", result.new_text)
} else {
MessageBox(tr("error"), result.error, [tr("ok")], [Function.noop])
post.querySelector("#editPost").click()