Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:/*Password Generator*/
- ((g, n, l, u, s, c, f, e) => {
- while (true) {
- if ((g = prompt("Please enter the number of characters to generate.", 15)) === null) return;
- if (isNaN(g = parseInt(g)) || (g <= 0)) {
- alert("Input must be a positive integer number.")
- } else break
- }
- n = "0123456789";
- u = (l = "abcdefghijklmnopqrstuvwxyz").toUpperCase();
- s = "!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~";
- c = {
- "Numbers": n,
- "Numbers & Lowercase Alphabets": n + l,
- "Numbers & Upperercase Alphabets": n + u,
- "Numbers & Alphabets": n + l + u,
- "Numbers & Symbols": n + s,
- "Numbers & Alphabets & Symbols": n + l + u + s,
- "Lowercase Alphabets": l,
- "Lowercase Alphabets & Symbols": l + s,
- "Upperercase Alphabets": u,
- "Upperercase Alphabets & Symbols": l + s,
- "Alphabets": l + u,
- "Alphabets & Symbols": l + u + s,
- "Symbols": s
- };
- f = (o, a, i, r) => {
- (a = []).length = g;
- for (i = 0; i < g; i++) a[i] = o[1][(Math.random() * o[1].length) << 0];
- e.textContent = a.join("");
- return `<tr><td>${o[0]}</td><td>${e.innerHTML}</td></tr>`
- };
- (e = document.createElement("DIV")).id = "pgbookmarklet";
- e.innerHTML = `<style>
- #pgbookmarklet,#pgbookmarklet *{all:revert}
- #pgbookmarklet{position:fixed;left:0;top:0;right:0;bottom:0;background:rgb(0,0,0,.5);cursor:pointer;font:14pt/normal sans-serif}
- #pgbookmarklet table{transform:translateY(10%);margin:auto;border-radius:.6em;border-spacing:.3em;padding:.3em;background:#fff;cursor:auto}
- #pgbookmarklet tr:nth-child(2n+1){background:#ddf}
- #pgbookmarklet td{padding:.3em}
- </style><table>${Object.entries(c).map(f).join("\n")}</table>`;
- document.documentElement.insertAdjacentHTML("beforeend", e.outerHTML);
- pgbookmarklet.onclick = e => (e.target === pgbookmarklet) && pgbookmarklet.remove()
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement