-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
197 lines (190 loc) · 8.27 KB
/
index.html
File metadata and controls
197 lines (190 loc) · 8.27 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Character Generator</title>
<style>
body {
font-family: 'Inter', sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #f0f4f8;
padding: 20px;
}
.container {
background-color: #ffffff;
padding: 30px;
border-radius: 15px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
text-align: center;
max-width: 70%;
width: 100%;
}
/* Styles updated to target type="text" */
input[type="text"] { /* Changed selector back to type="text" */
width: 90%;
padding: 12px;
margin-bottom: 20px;
border: 1px solid #cbd5e0;
border-radius: 8px;
font-size: 1em;
text-align: center;
outline: none;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
transition: border-color 0.3s;
}
input[type="text"]:focus { /* Changed selector back to type="text" */
border-color: #6366f1; /* Tailwind indigo-500 */
}
button {
padding: 12px 25px;
background-color: #6366f1; /* Tailwind indigo-500 */
color: white;
border: none;
border-radius: 8px;
font-size: 1em;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
button:hover {
background-color: #4f46e5; /* Tailwind indigo-600 */
transform: translateY(-2px);
}
button:active {
transform: translateY(0);
box-shadow: 0 2px 5px rgba(99, 102, 241, 0.2);
}
fieldset {
padding: 8px;
margin: 20px;
text-size: 24px;
width: 90%;
}
legend {
text-align: left;
text-size: 24px;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #6366f1;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #04AA6D;
cursor: pointer;
}
</style>
</head>
<body>
<!-- A random character generator for password generation, with blurr over text input and drag n drop enabled. This prevent screen shots being taken of randomly generated passwords via Microsofts AI Desktop tool. -->
<div class="container">
<h1 class="text-2xl font-semibold mb-6 text-gray-800">Random Character Generator</h1>
<!-- Changed input type from "password" back to "text" to allow selection and dragging -->
<fieldset><legend style="border: 1px;">Random Characters Blurred, drag and drop.</legend>
<input type="text" id="randomInput" placeholder="Click 'Generate' to fill" style="filter: blur(5px);" onclick="this.select();">
</fieldset>
<fieldset><legend style="border: 1px;">Sample Random Characters</legend>
<input type="text" id="randomInput01" placeholder="Sample Characters" style="filter: blur(0);" onclick="this.select();">
</fieldset>
<fieldset><legend style="border: 1px;">Sample Random Characters</legend>
<input type="text" id="randomInput02" placeholder="Sample Characters" style="filter: blur(0);" onclick="this.select();">
</fieldset>
<fieldset><legend><p><b>Number of Characters: <span id="sliderrange"></span></b></p></legend>
<input type="range" min="8" max="100" value="34" class="slider" id="myRange">
</fieldset>
<button onclick="generateRandomCharacters()">Generate Random Characters</button><br>
<br>
<button onclick="randomInput.style.filter = 'blur(0px)';">Unblur</button>
<button onclick="randomInput.style.filter = 'blur(5px)';">reBlur</button>
</div>
<script>
/**
* Function to generate 34 random lowercase characters and fill them into an input box.
*/
var length = 34; // default length
function generateRandomCharacters() {
// Define a static array containing all lowercase letters from 'a' to 'z'.
const characters = [
// upper cased letters a - z
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
// extra line of symbols to increase the chance of symbles bring drawn from array.
'!', '@', '#', '$', '%', '+', '&', '^', '*',
// end extra line.
// lower case letters a - z
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
// numbers 0 - 9
'0', '1', '2', '3', '4' , '5', '6', '7', '8', '9',
// 2 lines of symbols to increase the chance of being drawn from array.
'!', '@', '#', '$', '%', '+', '&', '^', '*',
'!', '@', '#', '$', '%', '+', '&', '^', '*'
];
let resultSample01 = '';
let resultSample02 = '';
let result = ''; // Initialize an empty string to store the random characters
// Loop 'length' times to pick 12 random characters
for (let i = 0; i < length; i++) {
// Generate a random index within the bounds of the 'characters' array
const randomIndex = Math.floor(Math.random() * characters.length);
// Append the character at the random index to the result string
result += characters[randomIndex];
}
for (let i = 0; i < length; i++) {
// Generate a random index within the bounds of the 'characters' array
const randomIndexSample01 = Math.floor(Math.random() * characters.length);
// Append the character at the random index to the result string
resultSample01 += characters[randomIndexSample01];
}
for (let i = 0; i < length; i++) {
// Generate a random index within the bounds of the 'characters' array
const randomIndexSample02 = Math.floor(Math.random() * characters.length);
// Append the character at the random index to the result string
resultSample02 += characters[randomIndexSample02];
}
// Get the input element by its ID
const inputElement = document.getElementById('randomInput');
// Set the value of the input element to the generated random string
if (inputElement) {
inputElement.value = result;
} else {
console.error("Input element with ID 'randomInput' not found.");
}
const thisinput01 = document.getElementById('randomInput01');
thisinput01.value = resultSample01;
const thisinput02 = document.getElementById('randomInput02');
thisinput02.value = resultSample02;
}
var slider = document.getElementById("myRange");
var output = document.getElementById("sliderrange");
output.innerHTML = slider.value;
slider.oninput = function() {
output.innerHTML = this.value;
length = this.value;
if (length < 101 && length > 7){
}else {
length = 34;
}
}
</script>
</body>
</html>