-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
120 lines (106 loc) · 3.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<link rel = "icon" type = "image/png" href = "logo/anyshare.png">
<link rel="manifest" href="manifest.json">
<script src="serviceworker.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-31PPT6CB61"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-31PPT6CB61');
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Any Share</title>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3403539919880614"
crossorigin="anonymous"></script>
<script>
let isDropHereVisible = false;
window.addEventListener("dragover", function (e) {
e.preventDefault();
if (!isDropHereVisible) {
document.querySelector(".Drop-here").style.display = "block";
isDropHereVisible = true;
}
});
window.addEventListener("drop", function (e) {
e.preventDefault();
document.querySelector(".Drop-here").style.display = "none";
isDropHereVisible = false;
if (e.dataTransfer.files.length > 0) {
handleFiles(e.dataTransfer.files);
}
});
window.addEventListener("dragenter", function (e) {
e.preventDefault();
if (!isDropHereVisible) {
document.querySelector(".Drop-here").style.display = "block";
isDropHereVisible = true;
}
});
window.addEventListener("dragleave", function (e) {
e.preventDefault();
const dropHere = document.querySelector(".Drop-here");
const rect = dropHere.getBoundingClientRect();
const x = e.clientX;
const y = e.clientY;
const isOutside = x < rect.left || x > rect.right || y < rect.top || y > rect.bottom;
const isLeftDocument = !document.elementFromPoint(x, y);
if (isOutside || isLeftDocument) {
dropHere.style.display = "none";
isDropHereVisible = false;
}
// if (e.dataTransfer.files.length > 0) {
// handleFiles(e.dataTransfer.files);
// }
});
function handleFiles(files) {
// Handle dropped files here
console.log(files);
// Call the function to upload the file
// uploadImage(files[0]);
// set this file to the input element of the file input
document.getElementById("file").files = files;
uploadImage();
}
</script>
</head>
<body>
<div class="card">
<h1>Any Share</h1>
<h2>Upload File</h2>
<input type="file" id="file" onchange="flesize()" /><br>
<center><button id="upload" onclick="uploadImage()">Upload<img id="uping" src="upload.png" alt="none" /></button>
</center>
<center>
<div id="ShowUniqueID" hidden>
<p>Unique ID</p><input type="text" id="showunique" value="23456" disabled></input>
</div>
</center>
<!-- <br> -->
<div class="Download" id="downloadiv">
<h2>Receive File</h2>
<input type="text" id="unique" placeholder="Enter Unique ID"><br>
<center><button id="show" onclick="showimage()">Download<img id="downimg" src="download.png"
alt="none" /></button>
</div>
</center>
</div>
<center>
<div class="Drop-here">
<h1 class="Drop-text">Drop Here</h1>
</div>
</center>
<p id="note">(Note: Upload limit has been increased to 100MB)</p>
<p id="footer">
Made With ❤️ By
<a href="https://github.com/Varshithvhegde">Varshith V Hegde</a>
</p>
</body>
<script src="https://www.gstatic.com/firebasejs/8.0.2/firebase.js"></script>
<script src="script.js"></script>
</html>