-
+
diff --git a/Web/static/css/main.css b/Web/static/css/main.css
index 680a4a14..ab108b24 100644
--- a/Web/static/css/main.css
+++ b/Web/static/css/main.css
@@ -50,6 +50,11 @@ h1 {
flex-direction: column;
}
+.display_flex_row {
+ display: flex;
+ flex-direction: row;
+}
+
.layout {
width: 791px;
margin: 0 auto;
@@ -264,7 +269,7 @@ h1 {
}
.upLeftErrors {
- position: absolute;
+ position: fixed;
display: flex;
flex-direction: column;
z-index: 1025;
@@ -1747,12 +1752,14 @@ body.scrolled .toTop:hover {
#wallAttachmentMenu {
position: absolute;
+ min-width: 94px;
border: 1px solid darkgrey;
background-color: white;
z-index: 32;
margin-top: -7px;
margin-left: -16px;
box-shadow: 0 1px 3px -1px;
+ user-select: none;
}
#wallAttachmentMenu>a {
@@ -2406,16 +2413,27 @@ a.poll-retract-vote {
}
}
-.upload {
+.post-horizontal {
margin-top: 8px;
}
-.upload .upload-item {
- width: 75px;
- height: 60px;
+.post-horizontal {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ gap: 3px;
+}
+
+.post-horizontal .upload-item {
+ /*width: 75px;
+ height: 60px;*/
overflow: hidden;
display: inline-block;
- margin-right: 3px;
+ position: relative;
+}
+
+.post-horizontal .upload-item.dragged {
+ filter: contrast(0.5);
}
.upload-item .upload-delete {
@@ -2425,7 +2443,7 @@ a.poll-retract-vote {
text-decoration: none;
color: #fff;
font-size: 11px;
- margin-left: 57px; /* мне лень переделывать :DDDD */
+ right: 0px;
opacity: 0;
transition: 0.25s;
}
@@ -3141,10 +3159,61 @@ body.article .floating_sidebar, body.article .page_content {
font-size: 11px;
}
-.topGrayBlock {
+.attachment_selector .topGrayBlock {
background: #F0F0F0;
height: 37px;
border-bottom: 1px solid #C7C7C7;
+ padding: 3px 10px;
+ align-items: center;
+ justify-content: center;
+ justify-content: space-between;
+}
+
+.attachment_selector .topGrayBlock #albumSelect {
+ width: 150px;
+}
+
+.attachment_selector #attachment_insert {
+ padding: 5px;
+ height: 281px;
+ overflow-y: scroll;
+}
+
+.attachment_selector #attachment_insert #attachment_insert_count {
+ position: fixed;
+ z-index: 1007;
+ width: 92%;
+ background: white;
+ margin-top: -5px;
+ padding-top: 6px;
+}
+
+#show_more {
+ width: 100%;
+ text-align: center;
+ background: #f0f0f0;
+ height: 22px;
+ padding-top: 9px;
+ cursor: pointer;
+ margin-top: 4px;
+}
+
+#show_more:hover {
+ background: #f2f2f2;
+}
+
+.attachment_selector #attachment_insert .photosList {
+ margin-top: 20px;
+ gap: 3px 6px;
+}
+
+.attachment_selector #attachment_insert .photosList .album-photo.selected img {
+ background-color: #646464;
+}
+
+.attachment_selector #attachment_insert .photosList .album-photo {
+ width: 15.8%;
+ margin: unset;
}
.edited {
diff --git a/Web/static/js/al_polls.js b/Web/static/js/al_polls.js
index 7e1c81cd..e231dcc3 100644
--- a/Web/static/js/al_polls.js
+++ b/Web/static/js/al_polls.js
@@ -64,8 +64,9 @@ function pollRadioPressed(radio) {
form.submit();
}
-function initPoll(id) {
- let form = $(`#wall-post-input${id}`).parent();
+function initPoll(event) {
+ let form = $(event.target.closest('.post-buttons')).parent();
+ const id = random_int(0, 100)
let mBody = `
@@ -87,9 +88,9 @@ function initPoll(id) {
`;
- MessageBox(tr("create_poll"), mBody, [tr("attach"), tr("cancel")], [
+ const msg = MessageBox(tr("create_poll"), mBody, [tr("attach"), tr("cancel")], [
function() {
- let dialog = $(this.$dialog().nodes[0]);
+ let dialog = $(msg.getNode().nodes[0]);
$("input", dialog).unbind();
let title = $("input[name=title]", dialog).val();
@@ -117,9 +118,9 @@ function initPoll(id) {
$(".post-has-poll", form).show();
},
function() {
- $("input", $(this.$dialog().nodes[0])).unbind();
+ $("input", $(msg.getNode())).unbind();
}
- ]);
+ ], true);
let editor = $(`#poll_editor${id}`);
$("input[name=newOption]", editor).bind("focus", function() {
diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js
index 76ce1750..b662ff85 100644
--- a/Web/static/js/al_wall.js
+++ b/Web/static/js/al_wall.js
@@ -1,21 +1,4 @@
-function handleUpload(id) {
- console.warn("блять...");
-
- u("#post-buttons" + id + " .postFileSel").not("#" + this.id).each(input => input.value = null);
-
- var indicator = u("#post-buttons" + id + " .post-upload");
- var file = this.files[0];
- if(typeof file === "undefined") {
- indicator.attr("style", "display: none;");
- } else {
- u("span", indicator.nodes[0]).text(trim(file.name) + " (" + humanFileSize(file.size, false) + ")");
- indicator.attr("style", "display: block;");
- }
-
- document.querySelector("#post-buttons" + id + " #wallAttachmentMenu").classList.add("hidden");
-}
-
-function initGraffiti(id) {
+function initGraffiti(event) {
let canvas = null;
const msgbox = new CMessageBox({
title: tr("draw_graffiti"),
@@ -27,7 +10,7 @@ function initGraffiti(id) {
let fName = "Graffiti-" + Math.ceil(performance.now()).toString() + ".jpeg";
let image = new File([blob], fName, {type: "image/jpeg", lastModified: new Date().getTime()});
- fastUploadImage(id, image)
+ __uploadToTextarea(image, u(event.target).closest('#write'))
}, "image/jpeg", 0.92);
canvas.teardown();
@@ -56,78 +39,18 @@ function initGraffiti(id) {
});
}
-function fastUploadImage(textareaId, file) {
- // uploading images
-
- 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;
- }
-
- let imagesCount = document.querySelector("#post-buttons" + textareaId + " input[name='photos']").value.split(",").length
-
- if(imagesCount > 10) {
- MessageBox(tr("error"), tr("too_many_photos"), [tr("ok")], [() => {Function.noop}])
- return
- }
-
- let xhr = new XMLHttpRequest
- let data = new FormData
-
- data.append("photo_0", file)
- data.append("count", 1)
- data.append("hash", u("meta[name=csrf]").attr("value"))
-
- xhr.open("POST", "/photos/upload")
-
- xhr.onloadstart = () => {
- document.querySelector("#post-buttons"+textareaId+" .upload").insertAdjacentHTML("beforeend", `
`)
- }
-
- xhr.onload = () => {
- let response = JSON.parse(xhr.responseText)
-
- appendImage(response, textareaId)
- }
-
- xhr.send(data)
-}
-
-// append image after uploading via /photos/upload
-function appendImage(response, textareaId) {
- if(!response.success) {
- MessageBox(tr("error"), (tr("error_uploading_photo") + response.flash.message), [tr("ok")], [() => {Function.noop}])
+u(document).on('click', '.menu_toggler', (e) => {
+ const post_buttons = $(e.target).closest('.post-buttons')
+ const wall_attachment_menu = post_buttons.find('#wallAttachmentMenu')
+ if(wall_attachment_menu.is('.hidden')) {
+ wall_attachment_menu.css({ opacity: 0 });
+ wall_attachment_menu.toggleClass('hidden').fadeTo(250, 1);
} else {
- let form = document.querySelector("#post-buttons"+textareaId)
- let photosInput = form.querySelector("input[name='photos']")
- let photosIndicator = form.querySelector(".upload")
-
- for(const phot of response.photos) {
- let id = phot.owner + "_" + phot.vid
-
- photosInput.value += (id + ",")
-
- u(photosIndicator).append(u(`
-
-
×
-
-
- `))
-
- u(photosIndicator.querySelector(`.upload #aP[data-id='${id}'] .upload-delete`)).on("click", () => {
- photosInput.value = photosInput.value.replace(id + ",", "")
- u(form.querySelector(`.upload #aP[data-id='${id}']`)).remove()
- })
- }
+ wall_attachment_menu.fadeTo(250, 0, function () {
+ $(this).toggleClass('hidden');
+ });
}
- u(`#post-buttons${textareaId} .upload #loader`).remove()
-}
+})
$(document).on("click", ".post-like-button", function(e) {
e.preventDefault();
@@ -139,7 +62,7 @@ $(document).on("click", ".post-like-button", function(e) {
var likes = counter.text() === "" ? 0 : counter.text();
var isLiked = heart.attr("id") === 'liked';
- ky(link);
+ ky.post(link)
heart.attr("id", isLiked ? '' : 'liked');
counter.text(parseInt(likes) + (isLiked ? -1 : 1));
if (counter.text() === "0") {
@@ -149,31 +72,6 @@ $(document).on("click", ".post-like-button", function(e) {
return false;
});
-function setupWallPostInputHandlers(id) {
- u("#wall-post-input" + id).on("paste", function(e) {
- // Если вы находитесь на странице с постом с id 11, то копирование произойдёт джва раза.
- // Оч ржачный баг, но вот как его исправить, я, если честно, не знаю.
-
- if(e.clipboardData.files.length === 1) {
- fastUploadImage(id, e.clipboardData.files[0])
- return;
- }
- });
-
- u("#wall-post-input" + id).on("dragover", function(e) {
- e.preventDefault()
-
- // todo add animation
- return;
- });
-
- $("#wall-post-input" + id).on("drop", function(e) {
- e.originalEvent.dataTransfer.dropEffect = 'move';
- fastUploadImage(id, e.originalEvent.dataTransfer.files[0])
- return;
- });
-}
-
u(document).on("input", "textarea", function(e) {
var boost = 5;
var textArea = e.target;
@@ -428,69 +326,6 @@ tippy(".client_app", {
}
});
-function addNote(textareaId, nid)
-{
- if(nid > 0) {
- document.getElementById("note").value = nid
- let noteObj = document.querySelector("#nd"+nid)
-
- let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note");
- nortd.style.display = "block"
-
- nortd.innerHTML = `${tr("note")} ${escapeHtml(noteObj.dataset.name)}`
- } else {
- document.getElementById("note").value = "none"
-
- let nortd = document.querySelector("#post-buttons"+textareaId+" .post-has-note");
- nortd.style.display = "none"
-
- nortd.innerHTML = ""
- }
-
- u("body").removeClass("dimmed");
- u(".ovk-diag-cont").remove();
- document.querySelector("html").style.overflowY = "scroll"
-}
-
-async function attachNote(id)
-{
- let notes = await API.Wall.getMyNotes()
- let body = ``
-
- if(notes.closed < 1) {
- body = `${tr("notes_closed")}`
- } else {
- if(notes.items.length < 1) {
- body = `${tr("no_notes")}`
- } else {
- body = `
- ${tr("select_or_create_new")}
-
`
-
- if(document.getElementById("note").value != "none") {
- body += `
-
- ${tr("do_not_attach_note")}
-
`
- }
-
- for(const note of notes.items) {
- body += `
-
- ${escapeHtml(note.name)}
-
- `
- }
-
- body += `
`
- }
- }
-
- let frame = MessageBox(tr("select_note"), body, [tr("cancel")], [Function.noop]);
-
- document.querySelector(".ovk-diag-body").style.padding = "10px"
-}
-
async function showArticle(note_id) {
u("body").addClass("dimmed");
let note = await API.Notes.getNote(note_id);
@@ -504,548 +339,6 @@ async function showArticle(note_id) {
u("body").addClass("article");
}
-// Оконный плеер
-
-$(document).on("click", "#videoOpen", async (e) => {
- e.preventDefault()
-
- document.getElementById("ajloader").style.display = "block"
-
- if(document.querySelector(".ovk-fullscreen-dimmer") != null) {
- u(".ovk-fullscreen-dimmer").remove()
- }
-
- let target = e.currentTarget
- let videoId = target.dataset.id
- let videoObj = null;
-
- try {
- videoObj = await API.Video.getVideo(Number(videoId))
- } catch(e) {
- console.error(e)
- document.getElementById("ajloader").style.display = "none"
- MessageBox(tr("error"), tr("video_access_denied"), [tr("cancel")], [
- function() {
- Function.noop
- }]);
- return 0;
- }
-
- document.querySelector("html").style.overflowY = "hidden"
-
- let player = null;
-
- if(target.dataset.dontload == null) {
- document.querySelectorAll("video").forEach(vid => vid.pause())
- if(videoObj.type == 0) {
- if(videoObj.isProcessing) {
- player = `
-
${tr("video_processing")}
- `
- } else {
- player = `
-
-
-
`
- }
- } else {
- player = videoObj.embed
- }
- } else {
- player = ``
- }
-
-
- let dialog = u(
- `
-
-
- ${videoObj.prevVideo != null ?
- `
-
-
` : ""}
- ${videoObj.nextVideo != null ? `
-
-
-
` : ""}
-
-
-
${escapeHtml(videoObj.title)}
-
- ${tr("hide_player")}
- |
- ${tr("close_player")}
-
-
- ${target.dataset.dontload == null ?`
-
- ${player}
-
` : ""}
-
-
-
-
-
-
-
- ${videoObj.description != null ? escapeHtml(videoObj.description) : "(" + tr("no_description") + ")"}
-
-
-
${tr("added")} ${videoObj.published} |
-
-
-
-
-
-
-
- ${tr("x_views", 0)}
-
-
-
-
-
-
-
-
`);
-
- u("body").addClass("dimmed").append(dialog);
-
- if(target.dataset.dontload != null) {
- let oldPlayer = document.querySelector(".miniplayer-video .fplayer")
- let newPlayer = document.querySelector(".top-part-player-subdiv")
-
- newPlayer.append(oldPlayer)
- }
-
- if(videoObj.type == 0 && videoObj.isProcessing == false) {
- bsdnInitElement(document.querySelector(".fplayer .bsdn"))
- }
-
- document.getElementById("ajloader").style.display = "none"
- u(".miniplayer").remove()
-})
-
-$(document).on("click", "#closeFplayer", async (e) => {
- u(".ovk-fullscreen-dimmer").remove();
- document.querySelector("html").style.overflowY = "scroll"
- u("body").removeClass("dimmed")
-})
-
-$(document).on("click", "#minimizePlayer", async (e) => {
- let targ = e.currentTarget
-
- let player = document.querySelector(".fplayer")
-
- let dialog = u(`
-
-
${escapeHtml(trimNum(targ.dataset.name, 26))}
-
-
-
-
-
-
-
-
- `);
-
- u("body").append(dialog);
- $('.miniplayer').draggable({cursor: "grabbing", containment: "body", cancel: ".miniplayer-video"});
-
- let newPlayer = document.querySelector(".miniplayer-video")
- newPlayer.append(player)
-
- document.querySelector(".miniplayer").style.top = window.scrollY;
- document.querySelector("#closeFplayer").click()
-})
-
-$(document).on("click", "#closeMiniplayer", async (e) => {
- u(".miniplayer").remove()
-})
-
-$(document).on("mouseup", "#gotopage", async (e) => {
- if(e.originalEvent.which === 1) {
- location.href = e.currentTarget.dataset.id
- } else if (e.originalEvent.which === 2) {
- window.open(e.currentTarget.dataset.id, '_blank')
- }
-
-})
-
-$(document).keydown(function(e) {
- if(document.querySelector(".top-part-player-subdiv .bsdn") != null && document.activeElement.tagName == "BODY") {
- let video = document.querySelector(".top-part-player-subdiv video")
-
- switch(e.keyCode) {
- // Пробел вроде
- case 32:
- document.querySelector(".top-part-player-subdiv .bsdn_teaserButton").click()
- break
- // Стрелка вниз, уменьшение громкости
- case 40:
- oldVolume = video.volume
-
- if(oldVolume - 0.1 > 0) {
- video.volume = oldVolume - 0.1
- } else {
- video.volume = 0
- }
-
- break;
- // Стрелка вверх, повышение громкости
- case 38:
- oldVolume = video.volume
-
- if(oldVolume + 0.1 < 1) {
- video.volume = oldVolume + 0.1
- } else {
- video.volume = 1
- }
-
- break
- // стрелка влево, отступ на 2 секунды назад
- case 37:
- oldTime = video.currentTime
- video.currentTime = oldTime - 2
- break
- // стрелка вправо, отступ на 2 секунды вперёд
- case 39:
- oldTime = document.querySelector(".top-part-player-subdiv video").currentTime
- document.querySelector(".top-part-player-subdiv video").currentTime = oldTime + 2
- break
- }
- }
-});
-
-$(document).keyup(function(e) {
- if(document.querySelector(".top-part-player-subdiv .bsdn") != null && document.activeElement.tagName == "BODY") {
- let video = document.querySelector(".top-part-player-subdiv video")
-
- switch(e.keyCode) {
- // Escape, закрытие плеера
- case 27:
- document.querySelector("#closeFplayer").click()
- break
- // Блять, я перепутал лево и право, пиздец я долбаёб конечно
- // Ну короче стрелка влево
- case 65:
- if(document.querySelector(".right-arrow") != null) {
- document.querySelector(".right-arrow").click()
- } else {
- console.info("No left arrow bro")
- }
- break
- // Фуллскрин
- case 70:
- document.querySelector(".top-part-player-subdiv .bsdn_fullScreenButton").click()
- break
- // стрелка вправо
- case 68:
- if(document.querySelector(".left-arrow") != null) {
- document.querySelector(".left-arrow").click()
- } else {
- console.info("No right arrow bro")
- }
- break;
- // S: Показать инфо о видео (не комментарии)
- case 83:
- document.querySelector(".top-part-player-subdiv #showComments").click()
- break
- // Мут (M)
- case 77:
- document.querySelector(".top-part-player-subdiv .bsdn_soundIcon").click()
- break;
- // Escape, выход из плеера
- case 192:
- document.querySelector(".top-part-buttons #minimizePlayer").click()
- break
- // Бля не помню сори
- case 75:
- document.querySelector(".top-part-player-subdiv .bsdn_playButton").click()
- break
- // Home, переход в начало видосика
- case 36:
- video.currentTime = 0
- break
- // End, переход в конец видосика
- case 35:
- video.currentTime = video.duration
- break;
- }
- }
-});
-
-$(document).on("click", "#showComments", async (e) => {
- if(document.querySelector(".bottom-part").style.display == "none" || document.querySelector(".bottom-part").style.display == "") {
- if(document.getElementById("vidComments").innerHTML == "") {
- let xhr = new XMLHttpRequest
- xhr.open("GET", "/video"+e.currentTarget.dataset.pid)
- xhr.onloadstart = () => {
- document.getElementById("vidComments").innerHTML = `
`
- }
-
- xhr.timeout = 10000;
-
- xhr.onload = () => {
- let parser = new DOMParser();
- let body = parser.parseFromString(xhr.responseText, "text/html");
- let comms = body.getElementById("comments")
- let commsHTML = comms.innerHTML.replace("expand_wall_textarea(11)", "expand_wall_textarea(999)")
- .replace("wall-post-input11", "wall-post-input999")
- .replace("post-buttons11", "post-buttons999")
- .replace("toggleMenu(11)", "toggleMenu(999)")
- .replace("toggleMenu(11)", "toggleMenu(999)")
- .replace(/ons11/g, "ons999")
- document.getElementById("vidComments").innerHTML = commsHTML
- }
-
- xhr.onerror = () => {
- document.getElementById("vidComments").innerHTML = `
${tr("comments_load_timeout")}`
- }
-
- xhr.ontimeout = () => {
- document.getElementById("vidComments").innerHTML = `
${tr("comments_load_timeout")}`
- };
-
- xhr.send()
- }
-
- document.querySelector(".bottom-part").style.display = "flex"
- e.currentTarget.innerHTML = tr("close_comments")
- } else {
- document.querySelector(".bottom-part").style.display = "none"
- e.currentTarget.innerHTML = tr("show_comments")
- }
-})
-
-$(document).on("click", "#shareVideo", async (e) => {
- let owner_id = e.currentTarget.dataset.owner
- let virtual_id = e.currentTarget.dataset.vid
- let body = `
-
${tr('auditory')}:
-
${tr("in_wall")}
-
${tr("in_group")}
-
-
${tr('your_comment')}:
-
-
-
-
-
- `
- MessageBox(tr("share_video"), body, [tr("share"), tr("cancel")], [
- (async function() {
- let type = $('input[name=type]:checked').val()
- let club = document.getElementById("groupId").value
-
- let asGroup = document.getElementById("asgroup").checked
- let signed = document.getElementById("signed").checked
-
- let repost = null;
-
- try {
- repost = await API.Video.shareVideo(Number(owner_id), Number(virtual_id), Number(type), uRepostMsgInput.value, Number(club), signed, asGroup)
- NewNotification(tr('information_-1'), tr('shared_succ_video'), null, () => {window.location.href = "/wall" + repost.pretty_id});
- } catch(e) {
- console.log("tudu")
- }
- }), (function() {
- Function.noop
- })], false);
-
- try {
- clubs = await API.Groups.getWriteableClubs();
- for(const el of clubs) {
- document.getElementById("groupId").insertAdjacentHTML("beforeend", `
`)
- }
- } catch(rejection) {
- console.error(rejection)
- document.getElementById("group").setAttribute("disabled", "disabled")
- }
-})
-
-$(document).on("click", "#videoAttachment", async (e) => {
- e.preventDefault()
-
- let body = `
-
-
-
- `
-
- let form = e.currentTarget.closest("form")
-
- MessageBox(tr("selecting_video"), body, [tr("close")], [Function.noop]);
-
- // styles for messageboxx
- document.querySelector(".ovk-diag-body").style.padding = "0"
- document.querySelector(".ovk-diag-cont").style.width = "580px"
- document.querySelector(".ovk-diag-body").style.height = "335px"
-
- async function insertVideos(page, query = "") {
- document.querySelector(".videosInsert").insertAdjacentHTML("beforeend", `
`)
-
- let vidoses
- let noVideosText = tr("no_videos")
- if(query == "") {
- vidoses = await API.Wall.getVideos(page)
- } else {
- vidoses = await API.Wall.searchVideos(page, query)
- noVideosText = tr("no_videos_results")
- }
-
- if(vidoses.count < 1) {
- document.querySelector(".videosInsert").innerHTML = `
${noVideosText}`
- }
-
- let pagesCount = Math.ceil(Number(vidoses.count) / 8)
- u("#loader").remove()
- let insert = document.querySelector(".videosInsert")
-
- for(const vid of vidoses.items) {
- let isAttached = (form.querySelector("input[name='videos']").value.includes(`${vid.video.owner_id}_${vid.video.id},`))
-
- insert.insertAdjacentHTML("beforeend", `
-
- `)
- }
-
- if(page < pagesCount) {
- document.querySelector(".videosInsert").insertAdjacentHTML("beforeend", `
-
- more...
-
`)
- }
- }
-
- $(".videosInsert").on("click", "#showMoreVideos", (e) => {
- u(e.currentTarget).remove()
- insertVideos(Number(e.currentTarget.dataset.page), document.querySelector(".topGrayBlock #vquery").value)
- })
-
- $(".topGrayBlock #vquery").on("change", async (e) => {
- await new Promise(r => setTimeout(r, 1000));
-
- if(e.currentTarget.value === document.querySelector(".topGrayBlock #vquery").value) {
- document.querySelector(".videosInsert").innerHTML = ""
- insertVideos(1, e.currentTarget.value)
- return;
- } else {
- console.info("skipping")
- }
- })
-
- insertVideos(1)
-
- function insertAttachment(id) {
- let videos = form.querySelector("input[name='videos']")
-
- if(!videos.value.includes(id + ",")) {
- if(videos.value.split(",").length > 10) {
- NewNotification(tr("error"), tr("max_attached_videos"))
- return false
- }
-
- form.querySelector("input[name='videos']").value += (id + ",")
-
- console.info(id + " attached")
- return true
- } else {
- form.querySelector("input[name='videos']").value = form.querySelector("input[name='videos']").value.replace(id + ",", "")
-
- console.info(id + " detached")
- return false
- }
- }
-
- $(".videosInsert").on("click", "#attachvid", (ev) => {
- // откреплено от псто
- if(!insertAttachment(ev.currentTarget.dataset.attachmentdata)) {
- u(`.post-has-videos .post-has-video[data-id='${ev.currentTarget.dataset.attachmentdata}']`).remove()
- ev.currentTarget.innerHTML = tr("attach")
- } else {
- ev.currentTarget.innerHTML = tr("detach")
-
- form.querySelector(".post-has-videos").insertAdjacentHTML("beforeend", `
-
- ${tr("video")} "${ovk_proc_strtr(escapeHtml(ev.currentTarget.dataset.name), 20)}"
-
- `)
-
- u(`#unattachVideo[data-id='${ev.currentTarget.dataset.attachmentdata}']`).on("click", (e) => {
- let id = ev.currentTarget.dataset.attachmentdata
- form.querySelector("input[name='videos']").value = form.querySelector("input[name='videos']").value.replace(id + ",", "")
-
- console.info(id + " detached")
-
- u(e.currentTarget).remove()
- })
- }
- })
-})
-
$(document).on("click", "#editPost", (e) => {
let post = e.currentTarget.closest("table")
let content = post.querySelector(".text")
@@ -1154,211 +447,293 @@ $(document).on("click", "#editPost", (e) => {
}
})
-// copypaste from videos picker
-$(document).on("click", "#photosAttachments", async (e) => {
- let body = `
-
-
- ${tr("upload_new_photo")}:
-
-
-