added a random word generator
This commit is contained in:
1 parent
1a61eb2034
commit
0994e78843
1 file changed
+380
@@ -0,0 +1,380 @@
|
||||
<!-- Base file structure and logic utilized from Random-Words.html -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Princess Pi's Magic Random Words Generator</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #fce4ec;
|
||||
--card-bg: #f3e5f5;
|
||||
--text-color: #4a148c;
|
||||
--text-muted: #7b1fa2;
|
||||
--accent-color: #90caf9;
|
||||
--accent-hover: #64b5f6;
|
||||
--border-color: #ce93d8;
|
||||
--success-color: #ec407a;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Marker Felt", cursive, sans-serif;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ASCII Art Background */
|
||||
#ascii-bg {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
z-index: -1;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
font-size: 10px;
|
||||
line-height: 10px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Replaced .container with #content and set 70% opacity */
|
||||
#content {
|
||||
background-color: var(--card-bg);
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: 16px;
|
||||
padding: 30px;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
box-shadow: 0 10px 25px -5px rgba(74, 20, 140, 0.15);
|
||||
opacity: 0.65; /* Makes #content and all children visually 70% opaque */
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
font-size: 1.6rem;
|
||||
text-align: center;
|
||||
/* Flex layout to keep characters inline if they wrap */
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
h1 span {
|
||||
transition: color 0.1s ease;
|
||||
}
|
||||
|
||||
.privacy-badge {
|
||||
background-color: rgba(236, 64, 122, 0.1);
|
||||
color: var(--success-color);
|
||||
border: 1px dashed var(--success-color);
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 0.95rem;
|
||||
color: var(--text-muted);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="number"],
|
||||
input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
background-color: #ffffff;
|
||||
border: 2px solid var(--border-color);
|
||||
color: var(--text-color);
|
||||
border-radius: 8px;
|
||||
font-size: 1rem;
|
||||
box-sizing: border-box;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-hover);
|
||||
}
|
||||
|
||||
.controls-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
background-color: var(--accent-color);
|
||||
color: #1a237e;
|
||||
border: 2px solid #64b5f6;
|
||||
padding: 12px;
|
||||
font-size: 1.1rem;
|
||||
font-weight: bold;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
margin-top: 10px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: var(--accent-hover);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.output-container {
|
||||
margin-top: 25px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 120px;
|
||||
background-color: #ffffff;
|
||||
border: 2px solid var(--border-color);
|
||||
color: var(--text-color);
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
font-family: monospace;
|
||||
font-size: 1.1rem;
|
||||
resize: vertical;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent-hover);
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
background-color: #e1bee7;
|
||||
border-color: #ce93d8;
|
||||
color: var(--text-color);
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.copy-btn:hover {
|
||||
background-color: #ce93d8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Preformatted text ASCII Art Background -->
|
||||
<pre id="ascii-bg">
|
||||
.. .....
|
||||
....------..
|
||||
..:--------.. .......
|
||||
..----------.. ....---..
|
||||
...---------=------::....:----:..
|
||||
..-----=+**************=-----:...
|
||||
.----+****************=-----...
|
||||
.--=****************=-----=**+:::--:....
|
||||
.-=#*********##**++=---====++**+-----:.
|
||||
..:==********#=.+@%-==++===++===++*=----...
|
||||
.:=::******%%+-::=++====+==++====+**=--...
|
||||
.:+..+*****--@===-:-%--====-=+====+*#=:..
|
||||
.-=.-****#=.#+===--=+===----======+*+..
|
||||
.:=:+****#@#+=====-**-----*+====++**:.
|
||||
.. .=****=--======-..%-----%+==++***+-..
|
||||
..=++***+-.----======..*-----#+==+***#%#+..
|
||||
.. .:-..---=====--------=-+==+**-@*. ............::::::....
|
||||
..=:..--===+-:-------*%+==*+#%**=. .....:-------------------------:.
|
||||
..............-:..--===+-..:-------+==+==.:... ...:----------------------------::.
|
||||
......:----------::=:...--==+--:.:-------+==+=:.... ....--------------------------:.....
|
||||
..:::----------------=-::.:--===---:.:------=--:.... ...:---------------------------...
|
||||
..:------------------=--:..:--=+=--------::.:+-..... ...------------------------------..
|
||||
...:-----------------:....----==-------:...=%*.......:::--------------------------------:..
|
||||
...--------------:+......---------------:+%%#.----------------------------:.......-----:..
|
||||
.:----===-------:-.. .:--------------*%%%%=--------------========------:.......-------:...
|
||||
..-:.:------------....-.=---------=#%%%%##%------------=-----------------------------------..
|
||||
.:--:....:--------:##*=:.-------=#%%%%%%#%+-----------=-------------------------------------:
|
||||
..:-----------------::*%%#-------=###%%%%##=--------------------------------------:............
|
||||
..:-------------------:.-#%%##+==+%%%%%%#%+------------------------...:::--------------::::::..
|
||||
...:----------------------..-#%#%%%%%%%%*+#%=-------------------------=-:....:----------------:...
|
||||
--------------------------:.-#%%%%%%%%+#@%%%--------------------------=++=-::---------------:...
|
||||
---------------------------...+%%%%%]%%%%#---------------------------------------------:....
|
||||
............------.....----:....-#%%%%%%%*=------------------------------::+=---------.......
|
||||
..:-... ....-----.. ....-=-------------------------------------.=*+=.......
|
||||
..---:....:-----:.......:--------------------------:-------------==+=-......
|
||||
.:-------------..........:---------------------------..:-------------==..........
|
||||
..-------------:... ...--------:...----------------....:-----------==-...........
|
||||
..:----==------:..-.... ..--------:...:---------------.....:----------=+-.....
|
||||
..------==+=++==-..+--:. .:--------.....-----------=*%=.. ..----------=+=......
|
||||
....------------........:... ..:--------.....-------+#%%#@%.. ...----------=+=......
|
||||
....---------===:............... .:----=+*#=. ..--+#**+%@@@#%+. ..:-:..=----=*=:.....
|
||||
:............:=::+=:--:=.=-.::=... ..*@*-+%@@@:.....-@@#%@*#@@@#%:.. ..-:..---:-#**+-.........
|
||||
.. ...::::....::-.:.::-.. ..*%:..*@@@*.. ..-%#%@@+%@@@@=.. ...::.=#=..-%*++=:... ...
|
||||
...... .......... ..**...*#=*%:. .-*#@%+#%@@@@+... ..*%@%+...+%+=*+=-...
|
||||
..*#:.-#+..+-. ..-*#**%%*%@@%=.. ..-%@@*:..+@%=:+**+=:..
|
||||
..*@#*%%=..==. .-*%@#%@##@@@#-. ...#@@%*-=%@@#:..-=++=-
|
||||
.:#@*-:++..==. .=#%@%*@@*%*=+*:....:.+@*::+%@@@%=......-*
|
||||
.-%+...=%##%-. .+@*@%*%@##*-:*+..:-==*@=..:#@+:=*:.......
|
||||
.:*#:..:*@@@%:. .-%@*%@#*%*#=..-%-....:+#=-.:#%-.:+-.......
|
||||
.+@#=.-*@@@@*.. ....-%@@@@@@=..+%*.. .-%--=+#%-.:*-. ....
|
||||
.-=++++++++=... .:***+++==::::... .-%#=-*#%#**#-.
|
||||
</pre>
|
||||
|
||||
<div id="content">
|
||||
<h1 id="titleText">Princess Pi's Magic Random Words Generator</h1>
|
||||
|
||||
<div class="privacy-badge">
|
||||
✨ 100% Offline • Zero Storage • Zero Logging • Web Crypto API ✨
|
||||
</div>
|
||||
|
||||
<div class="controls-row">
|
||||
<div class="form-group">
|
||||
<label for="wordCount">Number of Words</label>
|
||||
<input type="number" id="wordCount" value="12" min="1" max="256">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="delimiter">Custom Delimiter</label>
|
||||
<input type="text" id="delimiter" value=" ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button onclick="generateSecureWords()">Generate Magic Words</button>
|
||||
|
||||
<div class="output-container">
|
||||
<label for="output">Generated Output</label>
|
||||
<textarea id="output" readonly placeholder="Click generate to create magic words..."></textarea>
|
||||
<button class="copy-btn" onclick="copyToClipboard()">Copy to Clipboard</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Changed variable name from BIP39_WORDS to wordsListArray per your request
|
||||
// SecLists language-english.txt + SecLists us-citites.txt
|
||||
// sed 's/.*/"&"/' input.txt | paste -sd, - | sed 's/,/, /g' > output.txt
|
||||
const wordsListArray = [
|
||||
"Abbeville", "Abbotsford", "Abbott", "Abbottsburg", "Abbottstown", "Abbyville", "Abell", "Abercrombie", "Aberdeen", "Aberfoil", "Abernant", "Abernathy", "Abeytas", "Abie", "Abilene", "Abingdon", "Abington", "Abiquiu", "Abita Springs", "Abo", "Aboite", "Abraham", "Abram", "Abrams", "Absarokee", "Absecon", "Academy", "Accokeek", "Accomac", "Accord", "Ace", "Aceitunas", "Acequia", "Achille", "Achilles", "Ackerly", "Ackerman", "Ackley", "Ackworth", "Acme", "Acomita Lake", "Acra", "Acree", "Acton", "Acworth", "Acy", "Ada", "Adair", "Adair Village", "Adairsville", "Adairville", "Adams", "Adams Center", "Adams City", "Adamstown", "Adamsville", "Adario", "Addicks", "Addie", "Addieville", "Addington", "Addis", "Addison", "Addy", "Addyston", "Adel", "Adelaide", "Adelanto", "Adelino", "Adell", "Adelphi", "Adelphia", "Aden", "Adena", "Adgateville", "Adin", "Adjuntas", "Admire", "Adna", "Adona", "Adrian", "Advance", "Adwolf", "Ady", "Aetna", "Affton", "Afton", "Agar", "Agate", "Agate Beach", "Agawam", "Agency", "Agnes", "Agness", "Agnew", "Agnos", "Agoura", "Agra", "Agricola", "Agua Dulce", "Agua Fria", "Aguada", "Aguadilla", "Aguanga", "Aguas Buenas", "Aguas Claras", "Agudo", "Aguila", "Aguilar", "Aguilares", "Aguilita", "Ahloso", "Ahmeek", "Ahoskie", "Ahtanum", "Ahuimanu", "Ahwahnee", "Aibonito", "Aid", "Aiea", "Aiken", "Ailey", "Ainsworth", "Airmont", "Airport Drive", "Airway Heights", "Aitkin", "Ajo", "Akaska", "Akeley", "Akers", "Akhiok", "Akiachak", "Akiak", "Akin", "Akra", "Akron", "Akutan", "Alabam", "Alabaster", "Aladdin", "Alakanuk", "Alamance", "Alameda", "Alamo", "Alamo Alto", "Alamo Heights", "Alamo Oaks", "Alamogordo", "Alamosa", "Alamota", "Alanreed", "Alapaha", "Alba", "Albany", "Albee", "Albemarle", "Alberene", "Alberhill", "Albers", "Albert", "Albert City", "Albert Lea", "Alberta", "Alberton", "Albertson", "Albertville", "Albin", "Albion", "Alborn", "Albright", "Albuquerque", "Alburg", "Alburnett", "Alburtis", "Alcalde", "Alcan", "Alcester", "Alco", "Alcoa", "Alcoa Center", "Alcolu", "Alcoma", "Alda", "Aldan", "Alden", "Alden Bridge", "Alder", "Alderpoint", "Alderson", "Alderwood Manor", "Aldine", "Aldrich", "Aledo", "Aleknagik", "Alex", "Alexander", "Alexander City", "Alexandria", "Alexandria Bay", "Alexis", "Alfalfa", "Alfordsville", "Alfred", "Alger", "Algerita", "Algoa", "Algodones", "Algoma", "Algona", "Algonac", "Algonquin", "Algood", "Alhambra", "Ali Chukson", "Alice", "Aliceville", "Alicia", "Aline", "Aliquippa", "Alire", "Aliso Viejo", "Alix", "Alkabo", "Allakaket", "Allamuchy", "Allandale", "Allardt", "Alleene", "Allegan", "Allegany", "Alleghany", "Allegre", "Alleman", "Allen", "Allen City", "Allen Park", "Allendale", "Allenfarm", "Allenhurst", "Allenport", "Allenspark", "Allensville", "Allenton", "Allentown", "Allenville", "Allenwood", "Allerton", "Alley", "Allgood", "Alliance", "Alligator", "Allison", "Allison Gap", "Allison Park", "Allons", "Allouez", "Alloway", "Allport", "Allyn", "Alma", "Alma Center", "Almedia", "Almelund", "Almena", "Almeria", "Almira", "Almo", "Almon", "Almond", "Almont", "Almonte", "Almota", "Almy", "Almyra", "Alnwick", "Aloe", "Aloha", "Alondra Park", "Alpaugh", "Alpena", "Alpha", "Alpharetta", "Alpine", "Alquina", "Alsea", "Alsen", "Alsey", "Alsip", "Alston", "Alstown", "Alsuma", "Alta", "Alta Loma", "Alta Sierra", "Alta Vista", "Altadena", "Altair", "Altamahaw", "Altamont", "Altamonte Springs", "Altavista", "Altenburg", "Altha", "Altheimer", "Altmar", "Alto", "Alto Pass", "Alton", "Altona", "Altoona", "Altura", "Alturas", "Altus", "Alum Bridge", "Alva", "Alvarado", "Alvaton", "Alvin", "Alvo", "Alvord", "Alvordton", "Alvwood", "Alzada", "Amado", "Amador City", "Amagansett", "Amagon", "Amalga", "Amanda", "Amanda Park", "Amargosa Valley", "Amarillo", "Amasa", "Amawalk", "Amazonia", "Amber", "Amberg", "Amberley", "Ambler", "Amboy", "Ambridge", "Ambridge Heights", "Ambrose", "Amchitka", "Amelia", "Amelia City", "Amelia Court House", "Amenia", "American Beach", "American Canyon", "American Falls", "American Fork", "Americus", "Amery", "Ames", "Amesbury", "Amesville", "Amherst", "Amherst Junction", "Amherstdale", "Amidon", "Amiret", "Amistad", "Amite", "Amity", "Amity Gardens", "Amityville", "Ammon", "Amo", "Amonate", "Amoret", "Amorita", "Amory", "Amsden", "Amsterdam", "Amy", "Anacoco", "Anaconda", "Anacortes", "Anaheim", "Anahola", "Anahuac", "Anaktuvuk Pass", "Anamoose", "Anamosa", "Anandale", "Anasco", "Anatone", "Anawalt", "Ancho", "Anchor", "Anchor Point", "Anchorage", "Anchorville", "Ancient Oaks", "Andale", "Andalusia", "Anderson", "Anderson Mill", "Andersonville", "Andes", "Anding", "Andover", "Andrade", "Andrew", "Andrews", "Andrix", "Anegam", "Aneta", "Angel City", "Angel Fire", "Angela", "Angeles", "Angelica", "Angels City", "Angelus", "Angier", "Angiola", "Angle", "Angle Inlet", "Angleton", "Angola", "Angola on the Lake", "Angora", "Anguilla", "Angus", "Angwin", "Aniak", "Animas", "Anita", "Aniwa", "Ankeny", "Ankenytown", "Anmoore", "Ann Arbor", "AnLine truncated
|
||||
];
|
||||
|
||||
/**
|
||||
* Utility function to generate a random pastel color
|
||||
*/
|
||||
function getRandomPastel() {
|
||||
const hue = Math.floor(Math.random() * 360);
|
||||
return `hsl(${hue}, 100%, 75%)`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function for random timeouts
|
||||
*/
|
||||
function getRandomTimeout(min, max) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
// Initialization logic for UI animations
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
// --- H1 Character Color Animation ---
|
||||
const h1 = document.getElementById('titleText');
|
||||
const textChars = h1.innerText.split('');
|
||||
h1.innerText = ''; // Clear raw text
|
||||
|
||||
textChars.forEach(char => {
|
||||
const span = document.createElement('span');
|
||||
// Handle spaces explicitly
|
||||
span.innerHTML = char === ' ' ? ' ' : char;
|
||||
h1.appendChild(span);
|
||||
|
||||
const animateChar = () => {
|
||||
span.style.color = getRandomPastel();
|
||||
setTimeout(animateChar, getRandomTimeout(50, 500));
|
||||
};
|
||||
|
||||
// Kick off the animation loop for this character
|
||||
animateChar();
|
||||
});
|
||||
|
||||
// --- ASCII Art Background Animation ---
|
||||
const asciiBg = document.getElementById('ascii-bg');
|
||||
const animateAsciiBg = () => {
|
||||
asciiBg.style.color = getRandomPastel();
|
||||
setTimeout(animateAsciiBg, getRandomTimeout(200, 750));
|
||||
};
|
||||
|
||||
// Kick off the ASCII background loop
|
||||
animateAsciiBg();
|
||||
});
|
||||
|
||||
/**
|
||||
* Generates a string of cryptographically secure random words.
|
||||
*/
|
||||
function generateSecureWords() {
|
||||
const countInput = document.getElementById('wordCount').value;
|
||||
const delimiter = document.getElementById('delimiter').value;
|
||||
const outputArea = document.getElementById('output');
|
||||
|
||||
let numberOfWords = parseInt(countInput, 10);
|
||||
if (isNaN(numberOfWords) || numberOfWords < 1) {
|
||||
numberOfWords = 12;
|
||||
document.getElementById('wordCount').value = 12;
|
||||
}
|
||||
|
||||
const generatedWords = [];
|
||||
|
||||
// Array length evaluated dynamically allowing arbitrary additions/removals
|
||||
const wordListLength = wordsListArray.length;
|
||||
|
||||
for (let i = 0; i < numberOfWords; i++) {
|
||||
const randomBuffer = new Uint32Array(1);
|
||||
window.crypto.getRandomValues(randomBuffer);
|
||||
|
||||
const randomIndex = randomBuffer[0] % wordListLength;
|
||||
generatedWords.push(wordsListArray[randomIndex]);
|
||||
}
|
||||
|
||||
outputArea.value = generatedWords.join(delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the currently generated text in the textarea to the system clipboard.
|
||||
*/
|
||||
function copyToClipboard() {
|
||||
const outputArea = document.getElementById('output');
|
||||
|
||||
if (!outputArea.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
outputArea.select();
|
||||
outputArea.setSelectionRange(0, 99999);
|
||||
|
||||
navigator.clipboard.writeText(outputArea.value)
|
||||
.then(() => {
|
||||
const copyBtn = document.querySelector('.copy-btn');
|
||||
const originalText = copyBtn.innerText;
|
||||
copyBtn.innerText = "Copied! ✨";
|
||||
setTimeout(() => {
|
||||
copyBtn.innerText = originalText;
|
||||
}, 2000);
|
||||
})
|
||||
.catch(err => {
|
||||
console.warn('Clipboard API failed, attempting execCommand...', err);
|
||||
document.execCommand('copy');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user