1
0
mirror of https://github.com/S2-/pwgen.git synced 2025-08-03 01:00:04 +02:00

10 Commits

Author SHA1 Message Date
s2
9cf67b5dec v1.1.4 2017-11-21 08:21:57 +01:00
s2
736367738f make form nicer 2017-11-21 08:21:39 +01:00
s2
4dbd892d04 v1.1.3 2017-11-20 11:28:17 +01:00
s2
48f8b8d5bc add some more special chars 2017-11-20 11:27:36 +01:00
s2
2a0d1b0fe2 a screenshot 2017-11-16 09:42:57 +01:00
s2
710fb753b7 move everything to src 2017-11-16 09:24:32 +01:00
s2
c784e80ece 1.1.2 2017-11-16 09:17:11 +01:00
s2
8f7ec24032 change font 2017-11-16 09:17:03 +01:00
s2
9e6829e808 save settings immediately 2017-11-16 09:16:48 +01:00
s2
76362b8b6d escape \ so it can be used as special char 2017-11-16 08:41:33 +01:00
12 changed files with 76 additions and 40 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.project

BIN
img/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1 +0,0 @@

View File

@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="pwgen.css"/>
</head>
<body>
<form>
<div>
<label for"length">length</label>
<input type="number" id="length" value="14" min="0" name="length">
</div>
<div>
<label for"special">include special chars</label>
<input type="checkbox" id="special" checked="checked" name="special">
</div>
<div>
<label for"pw">your password</label>
<input type="text" id="pw" name="pw">
</div>
<div>
<button id="copy">copy to clipboard</button><button id="new">give me an other one</button>
</div>
<div>
<label for"directcopy">direct copy</label>
<input type="checkbox" id="directcopy" name="directcopy" title="next time when i click the button, copy the new password immediately to the clipboard">
</div>
</form>
<script src="pwgen.js"></script>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 473 B

View File

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -2,7 +2,7 @@
"description": "Just a toolbar button that generates a password and copies it to your clipboard.", "description": "Just a toolbar button that generates a password and copies it to your clipboard.",
"manifest_version": 2, "manifest_version": 2,
"name": "pwgen reloaded", "name": "pwgen reloaded",
"version": "1.1.1", "version": "1.1.4",
"homepage_url": "https://github.com/S2-/pwgen", "homepage_url": "https://github.com/S2-/pwgen",
"icons": { "icons": {
"48": "icons/lock-48.png" "48": "icons/lock-48.png"

22
src/popup/pwgen.css Normal file
View File

@@ -0,0 +1,22 @@
body {
margin: 15px;
}
input[type="number"] {
-moz-appearance: none;
color: var(--in-content-text-color);
border: 1px solid var(--in-content-box-border-color);
-moz-border-top-colors: none !important;
-moz-border-right-colors: none !important;
-moz-border-bottom-colors: none !important;
-moz-border-left-colors: none !important;
border-radius: 2px;
background-color: var(--in-content-box-background);
font-family: inherit;
font-size: inherit;
padding: 5px 10px;
}
input[type="checkbox"] {
margin-bottom: -7px;
}

45
src/popup/pwgen.html Normal file
View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="chrome://global/skin/global.css" type="text/css" />
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" type="text/css" />
<link rel="stylesheet" href="chrome://mozapps/content/extensions/extensions.css" type="text/css" />
<link rel="stylesheet" href="resource://gre-resources/forms.css" type="text/css" />
<link rel="stylesheet" href="pwgen.css"/>
</head>
<body>
<form>
<div>
<label for"length">length <input type="number" id="length" value="14" min="0" name="length"></label>
</div>
<div>
<input type="checkbox" id="special" checked="checked" name="special">
<label for"special">include special chars</label>
</div>
<div>
<label for="pw">your password</label>
<input type="text" id="pw" name="pw">
</div>
<div>
<button id="copy" style="margin-left: 0;">copy to clipboard</button><button id="new">give me an other one</button>
</div>
<hr>
<div>
<input type="checkbox" id="directcopy" name="directcopy" title="next time when i click the button, copy the new password immediately to the clipboard">
<label for="directcopy">direct copy</label>
</div>
</form>
<script src="pwgen.js"></script>
</body>
</html>

View File

@@ -1,7 +1,7 @@
function randPassword(length, includeSpecial) { function randPassword(length, includeSpecial) {
let pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"; let pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
if (includeSpecial) { if (includeSpecial) {
pwdChars += '°^!"§$%&/()=?`´\}][{²³€|<>-.,;:*+_'; pwdChars += '°^!"§$%&/()=?`´\\}][{²³€|<>-.,;:*+_µ@~';
} }
let randPassword = Array(length).fill(pwdChars).map(function(x) { let randPassword = Array(length).fill(pwdChars).map(function(x) {
return x[Math.floor(Math.random() * x.length)] return x[Math.floor(Math.random() * x.length)]
@@ -39,7 +39,6 @@ document.getElementById('new').addEventListener('click', (ev) => {
ev.preventDefault(); ev.preventDefault();
var params = getParams(); var params = getParams();
document.getElementById('pw').value = randPassword(params.length, params.special); document.getElementById('pw').value = randPassword(params.length, params.special);
saveOptions(params);
}); });
document.getElementById('copy').addEventListener('click', (ev) => { document.getElementById('copy').addEventListener('click', (ev) => {
@@ -47,9 +46,12 @@ document.getElementById('copy').addEventListener('click', (ev) => {
copypasstoclippboard(); copypasstoclippboard();
}); });
document.getElementById('directcopy').addEventListener('change', (ev) => { var list = document.getElementsByTagName('input');
saveOptions(getParams()); for (var i = 0; i < list.length; i++) {
}); list[i].addEventListener('change', (ev) => {
saveOptions(getParams());
});
}
loadOptions().then((options) => { loadOptions().then((options) => {
document.getElementById('length').value = options.length; document.getElementById('length').value = options.length;