Update pages.html
Browse files- pages.html +1 -57
pages.html
CHANGED
|
@@ -1676,62 +1676,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
-
|
| 1680 |
-
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
| 1681 |
-
event.preventDefault();
|
| 1682 |
-
var formData = new FormData(this);
|
| 1683 |
-
var request = new XMLHttpRequest();
|
| 1684 |
-
request.open('POST', '/up_page');
|
| 1685 |
-
request.upload.addEventListener('progress', function(event) {
|
| 1686 |
-
if (event.lengthComputable) {
|
| 1687 |
-
var percentComplete = (event.loaded / event.total) * 100;
|
| 1688 |
-
document.getElementById('progressBar').style.width = percentComplete + '%';
|
| 1689 |
-
document.getElementById('progressBar').innerText = Math.round(percentComplete) + '%';
|
| 1690 |
-
}
|
| 1691 |
-
}, false);
|
| 1692 |
-
request.addEventListener('load', function(event) {
|
| 1693 |
-
var response = event.target.responseText;
|
| 1694 |
-
if (event.target.status === 200) {
|
| 1695 |
-
var fullUrl = response.split('saved to ')[1];
|
| 1696 |
-
document.getElementById('imageUrl').innerText = 'Click to copy URL';
|
| 1697 |
-
document.getElementById('imageUrl').setAttribute('data-url', fullUrl);
|
| 1698 |
-
Toastify({
|
| 1699 |
-
text: "File uploaded successfully",
|
| 1700 |
-
duration: 3000,
|
| 1701 |
-
gravity: "top",
|
| 1702 |
-
position: "center",
|
| 1703 |
-
backgroundColor: "#4CAF50",
|
| 1704 |
-
}).showToast();
|
| 1705 |
-
} else if (event.target.status === 409) {
|
| 1706 |
-
Toastify({
|
| 1707 |
-
text: "File with this name already exists",
|
| 1708 |
-
duration: 3000,
|
| 1709 |
-
gravity: "top",
|
| 1710 |
-
position: "center",
|
| 1711 |
-
backgroundColor: "#FF5733",
|
| 1712 |
-
}).showToast();
|
| 1713 |
-
}
|
| 1714 |
-
document.getElementById('progressBar').style.width = '0%';
|
| 1715 |
-
document.getElementById('progressBar').innerText = '0%';
|
| 1716 |
-
}, false);
|
| 1717 |
-
request.send(formData);
|
| 1718 |
-
});
|
| 1719 |
-
|
| 1720 |
-
function copyToClipboard(element) {
|
| 1721 |
-
var tempInput = document.createElement("input");
|
| 1722 |
-
tempInput.value = element.getAttribute('data-url');
|
| 1723 |
-
document.body.appendChild(tempInput);
|
| 1724 |
-
tempInput.select();
|
| 1725 |
-
document.execCommand("copy");
|
| 1726 |
-
document.body.removeChild(tempInput);
|
| 1727 |
-
Toastify({
|
| 1728 |
-
text: "URL copied to clipboard",
|
| 1729 |
-
duration: 3000,
|
| 1730 |
-
gravity: "top",
|
| 1731 |
-
position: "center",
|
| 1732 |
-
backgroundColor: "#4CAF50",
|
| 1733 |
-
}).showToast();
|
| 1734 |
-
}
|
| 1735 |
-
</script>
|
| 1736 |
</body>
|
| 1737 |
</html>
|
|
|
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1680 |
</body>
|
| 1681 |
</html>
|