-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiscordlinkthingremover.html
90 lines (71 loc) · 3.15 KB
/
Discordlinkthingremover.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Parameter Remover</title>
<style>
/* Add your CSS code here */
body {
background-color: black;
color: grey;
}
input {
border: none;
border-radius: 10px;
padding: 10px;
outline: none;
box-shadow: inset 0 0 5px gray;
}
input[type=button]:hover {
background-color: blue;
color: grey;
}
input[type=button]:active {
transform: scale(0.9);
}
</style>
</head>
<body>
<label for="urlInput">Enter URL: (discord link unfucker)</label>
<input type="text" id="urlInput" style="width: 80%;" placeholder="https://example.com/image.jpg?ex=1234&is=5678">
<button onclick="removeParameters()">Remove Parameters</button>
<p id="result"></p>
<button onclick="copyToClipboard()">Copy URL</button>
<script>
function removeParameters() {
const urlInput = document.getElementById('urlInput').value;
// Create a URL object from the input string
let url = new URL(urlInput);
// Check if the URL has a query string
if (url.search) {
// Remove the specified parameters (in this case, everything after various file extensions)
if (url.pathname.endsWith('.jpg') || url.pathname.endsWith('.jpeg') || url.pathname.endsWith('.png') || url.pathname.endsWith('.gif') || url.pathname.endsWith('.bmp') || url.pathname.endsWith('.tiff') || url.pathname.endsWith('.mp4') || url.pathname.endsWith('.avi') || url.pathname.endsWith('.mkv') || url.pathname.endsWith('.mov') || url.pathname.endsWith('.wmv') || url.pathname.endsWith('.mp3') || url.pathname.endsWith('.wav') || url.pathname.endsWith('.m4a')) {
url.search = '';
}
// Display the cleaned URL
document.getElementById('result').textContent = url.toString();
} else {
// If the URL has no query string, just display it as is
document.getElementById('result').textContent = 'URL has no parameters: ' + urlInput;
}
}
function copyToClipboard() {
const cleanedUrl = document.getElementById('result').textContent;
// Create a text area element to hold the URL
const tempInput = document.createElement('textarea');
tempInput.value = cleanedUrl;
// Append the text area to the DOM
document.body.appendChild(tempInput);
// Select the text within the text area
tempInput.select();
tempInput.setSelectionRange(0, 99999); /* For mobile devices */
// Copy the selected text to the clipboard
document.execCommand('copy');
// Remove the temporary text area
document.body.removeChild(tempInput);
alert('URL copied to clipboard: ' + cleanedUrl);
}
</script>
</body>
</html>