Remove old, broken drag+drop code.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4390 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-08-06 12:03:37 +00:00
parent 39927e75f2
commit 0d82198849
2 changed files with 0 additions and 68 deletions

View File

@ -835,22 +835,6 @@ function send(value) {
} }
} }
function dragHover(event) {
event.stopPropagation();
event.preventDefault();
let input = document.getElementById("input");
if (event.type == "dragover") {
if (!input.classList.contains("drop")) {
input.classList.add("drop");
gOriginalInput = input.value;
input.value = "drop file to upload";
}
} else {
input.classList.remove("drop");
input.value = gOriginalInput;
}
}
function fixImage(sourceData, maxWidth, maxHeight, callback) { function fixImage(sourceData, maxWidth, maxHeight, callback) {
let result = sourceData; let result = sourceData;
let image = new Image(); let image = new Image();
@ -880,52 +864,6 @@ function sendImage(image) {
}); });
} }
function fileDropRead(event) {
sendImage(event.target.result);
}
function fileDrop(event) {
dragHover(event);
let done = false;
if (!done) {
let files = event.target.files || event.dataTransfer.files;
for (let i = 0; i < files.length; i++) {
let file = files[i];
if (file.type.substring(0, "image/".length) == "image/") {
let reader = new FileReader();
reader.onloadend = fileDropRead;
reader.readAsDataURL(file);
done = true;
}
}
}
if (!done) {
let html = event.dataTransfer.getData("text/html");
let match = /<img.*src="([^"]+)"/.exec(html);
if (match) {
sendImage(match[1]);
done = true;
}
}
if (!done) {
let text = event.dataTransfer.getData("text/plain");
if (text) {
send(text);
done = true;
}
}
}
function enableDragDrop() {
let body = document.body;
body.addEventListener("dragover", dragHover);
body.addEventListener("dragleave", dragHover);
body.addEventListener("drop", fileDrop);
}
function hashChange() { function hashChange() {
send({event: 'hashChange', hash: window.location.hash}); send({event: 'hashChange', hash: window.location.hash});
} }
@ -1118,7 +1056,6 @@ window.addEventListener("load", function() {
tag.appendChild(tooltip); tag.appendChild(tooltip);
} }
} }
enableDragDrop();
connectSocket(window.location.pathname); connectSocket(window.location.pathname);
if (window.localStorage.getItem('editing') == '1') { if (window.localStorage.getItem('editing') == '1') {

View File

@ -64,11 +64,6 @@ a:active {
color: #eee8d5; color: #eee8d5;
} }
#input.drop {
border: 2px solid;
color: #cb4b16;
}
.CodeMirror { .CodeMirror {
height: 100%; height: 100%;
padding: 0; padding: 0;