Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gsper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
gsper
Commits
d66f15d2
Commit
d66f15d2
authored
6 years ago
by
Millicent Billette
Browse files
Options
Downloads
Patches
Plain Diff
UX improvements
parent
3fed2ed2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/main.js
+21
-4
21 additions, 4 deletions
public/main.js
with
21 additions
and
4 deletions
public/main.js
+
21
−
4
View file @
d66f15d2
const
cores
=
navigator
.
hardwareConcurrency
;
addEventsListeners
(
document
.
querySelectorAll
(
"
#salt, #pass
"
),
"
change keyup
"
,
updateEstimate
);
updateEstimate
();
function
updateEstimate
(){
const
idSecList
=
multiLineString2cleanArray
(
document
.
getElementById
(
"
salt
"
).
value
);
const
passList
=
multiLineString2cleanArray
(
document
.
getElementById
(
"
pass
"
).
value
);
document
.
getElementById
(
"
combi
"
).
innerHTML
=
idSecList
.
length
*
passList
.
length
;
document
.
getElementById
(
"
temps
"
).
innerHTML
=
(
idSecList
.
length
*
passList
.
length
)
+
"
s
"
;
}
document
.
getElementById
(
"
compute
"
).
addEventListener
(
"
click
"
,
e
=>
{
const
pub
=
document
.
getElementById
(
"
pubkey
"
).
value
.
trim
();
const
pubRaw
=
Base58
.
decode
(
pub
);
const
idSecList
=
document
.
getElementById
(
"
salt
"
).
value
.
split
(
"
\n
"
).
map
(
str
=>
str
.
trim
());
const
passList
=
document
.
getElementById
(
"
pass
"
).
value
.
split
(
"
\n
"
).
map
(
str
=>
str
.
trim
());
document
.
getElementById
(
"
combi
"
).
innerHTML
=
idSecList
.
length
*
passList
.
length
;
document
.
getElementById
(
"
temps
"
).
innerHTML
=
(
idSecList
.
length
*
passList
.
length
)
+
"
s
"
;
const
idSecList
=
multiLineString2cleanArray
(
document
.
getElementById
(
"
salt
"
).
value
);
const
passList
=
multiLineString2cleanArray
(
document
.
getElementById
(
"
pass
"
).
value
);
updateEstimate
();
document
.
getElementById
(
"
percent
"
).
innerHTML
=
"
0%
"
;
for
(
let
idSec
of
idSecList
){
...
...
@@ -50,3 +59,11 @@ async function crypt(password, salt){
});
}
function
addEventsListeners
(
triggerNodes
,
events
,
functions
){
if
(
!
triggerNodes
.
length
)
triggerNodes
=
[
triggerNodes
];
if
(
typeof
events
!==
"
object
"
)
events
=
events
.
split
(
"
"
);
if
(
typeof
functions
!==
"
object
"
)
functions
=
[
functions
];
console
.
log
(
triggerNodes
[
0
].
addEventListener
,
events
,
functions
);
for
(
let
n
of
triggerNodes
)
events
.
forEach
(
e
=>
functions
.
forEach
(
f
=>
n
.
addEventListener
(
e
,
f
)));
}
function
multiLineString2cleanArray
(
rawStr
){
return
rawStr
.
split
(
"
\n
"
).
map
(
str
=>
str
.
trim
()).
filter
(
str
=>
str
!==
""
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment