-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
165 lines (143 loc) · 5.94 KB
/
index.html
File metadata and controls
165 lines (143 loc) · 5.94 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Authorization Callback Code</title>
<style>
body {
margin: 0;
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
transition: background 0.3s;
}
#container {
padding: 20px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
display: flex;
flex-direction: column;
align-items: stretch;
width: 90%;
max-width: 500px;
transition: background 0.3s, border-radius 0.3s;
}
h2 {
margin-top: 0;
font-size: 1.2em;
margin-bottom: 10px;
transition: color 0.3s;
}
#callbackBox {
position: relative;
display: flex;
align-items: center;
}
textarea {
width: 100%;
resize: none;
padding: 10px 40px 10px 10px;
font-size: 1em;
border: 1px solid #ccc;
border-radius: 6px;
transition: background 0.3s, border-color 0.3s, color 0.3s;
font-family: monospace;
color: inherit;
}
textarea.error {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
button.copy {
position: absolute;
right: 10px;
background: none;
border: none;
cursor: pointer;
padding: 6px;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.2s, transform 0.1s;
}
button.copy svg {
width: 20px;
height: 20px;
fill: currentColor;
}
button.copy:hover {
color: #007bff;
}
button.copy:active {
transform: scale(0.95);
}
</style>
</head>
<body>
<div id="container">
<h2 id="boxLabel">Authorization Code</h2>
<div id="callbackBox">
<textarea id="callback" rows="4" readonly></textarea>
<button class="copy" title="Copy" onclick="copyToClipboard()">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 111.07 122.88" style="enable-background:new 0 0 111.07 122.88" xml:space="preserve">
<style type="text/css"><![CDATA[.st0{fill-rule:evenodd;clip-rule:evenodd;}]]></style>
<g>
<path class="st0" d="M97.67,20.81L97.67,20.81l0.01,0.02c3.7,0.01,7.04,1.51,9.46,3.93c2.4,2.41,3.9,5.74,3.9,9.42h0.02v0.02v75.28 v0.01h-0.02c-0.01,3.68-1.51,7.03-3.93,9.46c-2.41,2.4-5.74,3.9-9.42,3.9v0.02h-0.02H38.48h-0.01v-0.02 c-3.69-0.01-7.04-1.5-9.46-3.93c-2.4-2.41-3.9-5.74-3.91-9.42H25.1c0-25.96,0-49.34,0-75.3v-0.01h0.02 c0.01-3.69,1.52-7.04,3.94-9.46c2.41-2.4,5.73-3.9,9.42-3.91v-0.02h0.02C58.22,20.81,77.95,20.81,97.67,20.81L97.67,20.81z M0.02,75.38L0,13.39v-0.01h0.02c0.01-3.69,1.52-7.04,3.93-9.46c2.41-2.4,5.74-3.9,9.42-3.91V0h0.02h59.19 c7.69,0,8.9,9.96,0.01,10.16H13.4h-0.02v-0.02c-0.88,0-1.68,0.37-2.27,0.97c-0.59,0.58-0.96,1.4-0.96,2.27h0.02v0.01v3.17 c0,19.61,0,39.21,0,58.81C10.17,83.63,0.02,84.09,0.02,75.38L0.02,75.38z M100.91,109.49V34.2v-0.02h0.02 c0-0.87-0.37-1.68-0.97-2.27c-0.59-0.58-1.4-0.96-2.28-0.96v0.02h-0.01H38.48h-0.02v-0.02c-0.88,0-1.68,0.38-2.27,0.97 c-0.59,0.58-0.96,1.4-0.96,2.27h0.02v0.01v75.28v0.02h-0.02c0,0.88,0.38,1.68,0.97,2.27c0.59,0.59,1.4,0.96,2.27,0.96v-0.02h0.01 h59.19h0.02v0.02c0.87,0,1.68-0.38,2.27-0.97c0.59-0.58,0.96-1.4,0.96-2.27L100.91,109.49L100.91,109.49L100.91,109.49 L100.91,109.49z"/>
</g>
</svg>
</button>
</div>
</div>
<script>
const params = new URLSearchParams(window.location.search);
const label = params.get("label") || "Authorization Code";
document.getElementById("boxLabel").innerText = label;
const callback =
params.get("callback") ||
params.get("code") ||
params.get("token") ||
params.get("access_token") ||
params.get("auth_code");
const error = params.get("error");
const bgColor = params.get("bgColor") || "#ffffff";
const boxColor = params.get("boxColor") || "#f9f9f9";
const inputColor = params.get("inputColor") || "#ffffff";
const copyColor = params.get("copyColor") || "#333333";
const borderRadius = params.get("borderRadius") || "12px";
const errorColor = params.get("errorColor") || "#a94442";
const labelColor = params.get("labelColor") || "#000000";
const codeColor = params.get("codeColor") || "#000000";
document.body.style.background = bgColor;
const container = document.getElementById("container");
const textarea = document.getElementById("callback");
const copyBtn = document.querySelector("button.copy");
container.style.background = boxColor;
container.style.borderRadius = borderRadius;
textarea.style.background = inputColor;
copyBtn.style.color = copyColor;
document.getElementById("boxLabel").style.color = labelColor;
textarea.style.color = codeColor;
if (error) {
textarea.value = `Error: ${error}`;
textarea.style.color = errorColor;
textarea.style.background = inputColor;
} else if (callback) {
textarea.value = callback;
textarea.style.color = codeColor;
} else {
textarea.value = "No callback found in URL.";
textarea.style.color = errorColor;
}
function copyToClipboard() {
if (textarea.disabled) return;
textarea.select();
navigator.clipboard.writeText(textarea.value).then(() => {
copyBtn.style.color = "green";
setTimeout(() => copyBtn.style.color = copyColor, 1000);
});
}
</script>
</body>
</html>