xenua
2 years ago
7 changed files with 152 additions and 6 deletions
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
// i dont know how to java script. if you do know how to,
|
||||
// want to rewrite this into proper java script,
|
||||
// and can do so without introducing any dependencies etc,
|
||||
// email me at v-contrib @ xenua dot me
|
||||
|
||||
document.addEventListener('load', () => { |
||||
let replaceMe = document.querySelector("#scriptReplaceTarget"); |
||||
// TODO
|
||||
}) |
||||
|
||||
window.addEventListener('paste', (event) => { |
||||
handleDataTransfer(event.clipboardData); |
||||
}); |
||||
|
||||
handleDataTransfer = (data) => { |
||||
if (data.clipboardData.items) { |
||||
let item = data.clipboardData.items[0]; |
||||
if (item.kind === 'string') { |
||||
item.getAsString((thing) => { |
||||
try { |
||||
let url = new URL(thing); |
||||
promptUser("you pasted a valid link; do you want to create a short link?", () => { |
||||
createShortLink(url); |
||||
}, () => { |
||||
initTextArea(thing); |
||||
}); |
||||
} catch (e) { |
||||
initTextArea(thing); |
||||
} |
||||
}) |
||||
} else { |
||||
uploadFile(item.getAsFile()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
promptUser = (promptText, yesAction, noAction) => { |
||||
|
||||
} |
||||
|
||||
initTextArea = (initialContents) => { |
||||
|
||||
} |
||||
|
||||
uploadFile = (file) => { |
||||
|
||||
} |
||||
|
||||
onDropHandler = (event) => { |
||||
} |
||||
|
||||
onDragEnterHandler = (event) => { |
||||
if (event.target.classList.contains("dropzone")) { |
||||
event.target.classList.add("dragover"); |
||||
} |
||||
} |
||||
|
||||
onDragLeaveHandler = (event) => { |
||||
if (event.target.classList.contains("dropzone")) { |
||||
event.target.classList.remove("dragover"); |
||||
} |
||||
} |
||||
|
||||
createShortLink = (url) => { |
||||
|
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %} |
||||
|
||||
{% block main %} |
||||
<div id="theBox"> |
||||
<!-- <noscript id="scriptReplaceTarget">--> |
||||
<span class="logo">^V</span> |
||||
<div> |
||||
<span> |
||||
lets you upload files and images |
||||
<form method="post"> |
||||
<input type="file" name="file" required> |
||||
<input type="submit" value="upload"> |
||||
</form> |
||||
</span> |
||||
<span> |
||||
or create short links |
||||
<form method="post"> |
||||
<label for="link">to</label> |
||||
<input type="url" name="link" placeholder="https://youtu.be/dQw4w9WgXcQ" required> |
||||
<input type="submit" value="create short link"> |
||||
</form> |
||||
</span> |
||||
<form method="post"> |
||||
<div> |
||||
<span>or share some text</span> |
||||
<input type="submit" value="upload text"> |
||||
</div> |
||||
<textarea name="text" placeholder="text area meow" required></textarea> |
||||
</form> |
||||
</div> |
||||
<!-- </noscript>--> |
||||
</div> |
||||
{% endblock main %} |
Loading…
Reference in new issue