-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunURL.xhtml
More file actions
74 lines (74 loc) · 2.18 KB
/
unURL.xhtml
File metadata and controls
74 lines (74 loc) · 2.18 KB
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
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<title>decode URL</title>
<head>
<script type='text/ecmascript'>
<![CDATA[
void function () {
if (document.readyState !== "loading") return this.call(document);
else return document.addEventListener("DOMContentLoaded", this);
}.call(
function () {
'use strict';
function decode(form, RE) {
var input = form.querySelector('input[type="text"]');
var output = form.querySelector('a');
form.querySelector('input[type="button"]').addEventListener(
'click',
function (event) {
input.value = '';
output.setAttribute('href', '');
output.textContent = '';
}
);
form.addEventListener(
'submit',
function (event) {
event.preventDefault();
var l = decodeURIComponent(input.value.replace(RE, ''));
output.setAttribute('href', l);
output.textContent = l;
}
);
}
var forms = document.getElementsByTagName('form');
decode(forms.item(0), /^https:\/\/[^\/]*\/url\?(?:[^&]|&[^u]|&u[^r]|&ur[^l]|&url[^=])*&url=|&.*$/g);
decode(forms.item(1), /^https:\/\/www\.youtube\.com\/redirect\?(?:[^&]|&[^q]|&q[^=])*&q=|&.*$/g);
decode(forms.item(2), /^https:\/\/l\.facebook\.com\/l\.php\?u=/);
}
);
]]>
</script>
</head>
<body>
<form>
<div style='display: flex; align-items: center'>
Google
<input type='submit' value='Decode'/>
<input type='button' value='Clear'/>
<input type='text' placeholder='Google' style='flex-grow: 1'/>
</div>
<a/>
</form>
<hr/>
<form>
<div style='display: flex; align-items: center'>
YouTube
<input type='submit' value='Decode'/>
<input type='button' value='Clear'/>
<input type='text' placeholder='YouTube' style='flex-grow: 1'/>
</div>
<a/>
</form>
<hr/>
<form>
<div style='display: flex; align-items: center'>
Facebook
<input type='submit' value='Decode'/>
<input type='button' value='Clear'/>
<input type='text' placeholder='Facebook' style='flex-grow: 1'/>
</div>
<a/>
</form>
</body>
</html>