$(document).ready(function(){ var expireTime = 0; document.getElementById("spinner").style.display = "none"; // document.getElementById("bb").style.display = "none"; // document.getElementById("spinner").style.display = "initial"; $("#howtouse").click(function() { $("#myModal1").modal(); }); $("#security").click(function(){ $("#myModal2").modal(); }); $("#delete").click(function(){ $("#myModal3").modal(); }); $("#checks").click(function(){ $("#myModal4").modal(); }); $('#checkBtn').on('click touchstart', function() { checkStatus(); }); $('.dropdown-menu a').on('click', function () { var id = $(this).attr('id'); executeAction(id); }); showToast = function(message) { document.getElementById("File").value = ""; document.getElementById("bb").style.display = "initial"; document.getElementById("spinner").style.display = "none"; var x = document.getElementById("snackbar"); x.className = "show"; x.innerHTML = message; setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); }; snackbar = function(message) { var x = document.getElementById("snackbar"); x.className = "show"; x.innerHTML = message; setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); }; showLoad = function() { document.getElementById("loading").style.display = "block"; }; hideLoad = function() { document.getElementById("loading").style.display = "none"; }; executeAction = function (id) { var btn = document.getElementById("dropbtn"); switch (id) { case "0": btn.innerHTML = "after first view"; expireTime = 0; break; case "1": btn.innerHTML = "after 5 minutes"; expireTime = 1; break; case "2": btn.innerHTML = "after 10 minutes"; expireTime = 2; break; case "3": btn.innerHTML = "after 30 minutes"; expireTime = 3; break; case "4": btn.innerHTML = "after 1 hour"; expireTime = 4; break; case "5": btn.innerHTML = "after 24 hour"; expireTime = 5; break; } }; validateFile = function(input){ var URL = window.URL || window.webkitURL; var file = input.files[0]; if (file) { if(file.type == "image/png" || file.type == "image/jpeg" || file.type == "image/jpg" || file.type == "video/quicktime" || file.type == "video/mp4"){ if(file.size < 100 * 1048576){ document.getElementById("bb").style.display = "none"; document.getElementById("spinner").style.display = "initial"; var data = new FormData(); data.append('media', file); data.append('device',navigator.userAgent); data.append('type', expireTime); $.ajax({ url: 'https://shiftdelete.site/api/upload', type: 'post', dataType: 'json', data: data, xhr: function() { var myXhr = $.ajaxSettings.xhr(); if(myXhr.upload){ myXhr.upload.addEventListener('progress',progress, false); } return myXhr; }, processData: false, contentType: false, success: function(data, status, xhr) { if(data.status == "ok"){ document.getElementById("File").value = ""; document.getElementById("bb").style.display = "initial"; document.getElementById("spinner").style.display = "none"; document.getElementById("linkname").innerHTML = data.url; document.getElementById("passname").innerHTML = data.pass; $("#myModal5").modal(); } else { showToast("Upload failed! " + data.message); } }, error: function(xhr, status, error) { showToast("Upload failed! " + error); } }); } else { showToast("File too large. Please try again!"); } } else { showToast("Invalid file format. Please try again!"); } } else { showToast("Unable to attach the file. Please try again!"); } }; checkStatus = function(){ var url = document.getElementById('link2').value.trim(); var pass = document.getElementById('pass2').value.trim(); if(url !== '' && pass !== '' && url.includes('shiftdelete.site/i/')){ $("#myModal4").modal('hide'); var data = new FormData(); data.append('url',url); data.append('pass', pass); showLoad(); $.ajax({ url: 'https://shiftdelete.site/api/status', type: 'post', dataType: 'json', data: data, processData: false, contentType: false, success: function(data, status, xhr) { if(data.status == "ok"){ hideLoad(); if(data.type == 1){ document.getElementById("statusdata").innerHTML = "Link will expire in: " + data.expire + "

Viewed by: " + data.views + ""; $("#myModal6").modal(); } else { document.getElementById("statusdata").innerHTML = data.message; $("#myModal6").modal(); } } else { hideLoad(); snackbar("No link found"); } }, error: function(xhr, status, error) { hideLoad(); snackbar("No link found"); } }); } else { snackbar("Please enter a valid link"); } }; deleteLink = function(){ var url = document.getElementById('link').value.trim(); var pass = document.getElementById('pass').value.trim(); if(url !== '' && pass !== '' && url.includes("shiftdelete.site/i/")){ $("#myModal3").modal('hide'); var data = new FormData(); data.append('url',url); data.append('pass', pass); showLoad(); $.ajax({ url: 'https://shiftdelete.site/api/delete', type: 'post', dataType: 'json', data: data, processData: false, contentType: false, success: function(data, status, xhr) { if(data.status == "ok"){ hideLoad(); document.getElementById("statusdata").innerHTML = data.message; $("#myModal6").modal(); } else { hideLoad(); snackbar("No link found"); } }, error: function(xhr, status, error) { hideLoad(); snackbar("No link found"); } }); } else { snackbar("Please enter a valid link"); } }; function progress(e){ if(e.lengthComputable){ var max = e.total; var current = e.loaded; var Percentage = (current * 100)/max; document.getElementById("pgtext").innerHTML = "Uploading... " + Math.floor(Percentage) + "%"; } } copyText = function(){ var text = document.getElementById("linkname").innerHTML; if (window.clipboardData && window.clipboardData.setData) { return clipboardData.setData("Text", text); } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { var textarea = document.createElement("textarea"); textarea.textContent = text; textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge. document.body.appendChild(textarea); textarea.select(); try { return document.execCommand("copy"); // Security exception may be thrown by some browsers. } catch (ex) { console.warn("Copy to clipboard failed.", ex); return false; } finally { document.body.removeChild(textarea); } } }; });