mirror of
https://github.com/openvk/openvk
synced 2025-01-09 01:09:46 +03:00
Fix video bruh moment in textarea
This commit is contained in:
parent
37696673bf
commit
4c758e35fc
2 changed files with 14 additions and 9 deletions
|
@ -10,6 +10,9 @@
|
|||
<div id="post-buttons{$textAreaId}" style="display: none;">
|
||||
<div class="upload">
|
||||
|
||||
</div>
|
||||
<div class="post-upload">
|
||||
<span style="color: inherit;"></span>
|
||||
</div>
|
||||
<div class="post-has-poll">
|
||||
{_poll}
|
||||
|
@ -52,7 +55,7 @@
|
|||
</label>
|
||||
</div>
|
||||
<input type="file" class="postFileSel" id="postFilePic" name="_pic_attachment" accept="image/*" style="display:none;" />
|
||||
<input type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display:none;" />
|
||||
<input type="file" class="postFileSel" id="postFileVid" name="_vid_attachment" accept="video/*" style="display:none;" onchange="handleVideoTAreaUpdate(event, {$textAreaId})" />
|
||||
<input type="hidden" name="poll" value="none" />
|
||||
<input type="hidden" name="type" value="1" />
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
|
@ -91,10 +94,6 @@
|
|||
|
||||
<script>
|
||||
$(document).ready(() => {
|
||||
u("#post-buttons{$textAreaId} .postFileSel").on("change", function() {
|
||||
handleUpload.bind(this, {$textAreaId})();
|
||||
});
|
||||
|
||||
setupWallPostInputHandlers({$textAreaId});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -22,10 +22,16 @@ function trim(string) {
|
|||
return newStr;
|
||||
}
|
||||
|
||||
function handleUpload(id) {
|
||||
console.warn("блять...");
|
||||
|
||||
u("#post-buttons" + id + " .postFileSel").not("#" + this.id).each(input => input.value = null);
|
||||
function handleVideoTAreaUpdate(event, id) {
|
||||
console.log(event, id);
|
||||
let indicator = u("#post-buttons" + id + " .post-upload");
|
||||
let file = event.target.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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue