-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add button to clear history for one item #260
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,69 +61,91 @@ function view(ctl, params) { | |
nodes.push( | ||
m( | ||
"div.logins", | ||
this.results.map(function (result) { | ||
const storeBgColor = result.store.bgColor || result.store.settings.bgColor; | ||
const storeColor = result.store.color || result.store.settings.color; | ||
this.results | ||
.filter((result) => { | ||
return !this.currentDomainOnly || result.inCurrentHost || result.recent.when; | ||
}) | ||
.map(function (result) { | ||
console.log(result); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably no need for keeping |
||
const storeBgColor = result.store.bgColor || result.store.settings.bgColor; | ||
const storeColor = result.store.color || result.store.settings.color; | ||
|
||
return m( | ||
"div.part.login", | ||
{ | ||
key: result.index, | ||
tabindex: 0, | ||
onclick: function (e) { | ||
var action = e.target.getAttribute("action"); | ||
if (action) { | ||
result.doAction(action); | ||
} else { | ||
result.doAction("fill"); | ||
} | ||
return m( | ||
"div.part.login", | ||
{ | ||
key: result.index, | ||
tabindex: 0, | ||
onclick: function (e) { | ||
var action = e.target.getAttribute("action"); | ||
if (action) { | ||
result.doAction(action); | ||
} else { | ||
result.doAction("fill"); | ||
} | ||
}, | ||
onkeydown: keyHandler.bind(result), | ||
}, | ||
onkeydown: keyHandler.bind(result), | ||
}, | ||
[ | ||
m("div.name", { title: "Fill username / password | <Enter>" }, [ | ||
m("div.line1", [ | ||
m( | ||
"div.store.badge", | ||
{ | ||
style: `background-color: ${storeBgColor}; | ||
[ | ||
m("div.name", { title: "Fill username / password | <Enter>" }, [ | ||
m("div.line1", [ | ||
m( | ||
"div.store.badge", | ||
{ | ||
style: `background-color: ${storeBgColor}; | ||
color: ${storeColor}`, | ||
}, | ||
result.store.name | ||
), | ||
m("div.path", [m.trust(result.path)]), | ||
result.recent.when > 0 | ||
? m("div.recent", { | ||
title: | ||
"Used here " + | ||
result.recent.count + | ||
" time" + | ||
(result.recent.count > 1 ? "s" : "") + | ||
", last " + | ||
Moment(new Date(result.recent.when)).fromNow(), | ||
}) | ||
: null, | ||
}, | ||
result.store.name | ||
), | ||
m("div.path", [m.trust(result.path)]), | ||
result.recent.when > 0 | ||
? [ | ||
m("div.recent", { | ||
title: | ||
"Used here " + | ||
result.recent.count + | ||
" time" + | ||
(result.recent.count > 1 ? "s" : "") + | ||
", last " + | ||
Moment( | ||
new Date(result.recent.when) | ||
).fromNow(), | ||
}), | ||
m("div.clear-recent", { | ||
title: "Forget recent usage here", | ||
onclick: (e) => { | ||
e.stopPropagation(); | ||
result.recent.when = 0; | ||
document | ||
.querySelector( | ||
".part.search input[type='text']" | ||
) | ||
.dispatchEvent(new Event("input")); | ||
result.doAction("clearRecent"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pressing on the "Clear usage" button for some reason requires me to touch Yubikey, not sure why, but it definitely shouldn't, as I am not intending to decrypt the password entry... And if I don't touch Yubikey, then the recent will not be cleared 🤔 |
||
}, | ||
}), | ||
] | ||
: null, | ||
]), | ||
m("div.line2", [m.trust(result.display)]), | ||
]), | ||
m("div.line2", [m.trust(result.display)]), | ||
]), | ||
m("div.action.copy-user", { | ||
tabindex: 0, | ||
title: "Copy username | <Ctrl+Shift+C>", | ||
action: "copyUsername", | ||
}), | ||
m("div.action.copy-password", { | ||
tabindex: 0, | ||
title: "Copy password | <Ctrl+C>", | ||
action: "copyPassword", | ||
}), | ||
m("div.action.details", { | ||
tabindex: 0, | ||
title: "Open Details | <Ctrl+O>", | ||
action: "getDetails", | ||
}), | ||
] | ||
); | ||
}) | ||
m("div.action.copy-user", { | ||
tabindex: 0, | ||
title: "Copy username | <Ctrl+Shift+C>", | ||
action: "copyUsername", | ||
}), | ||
m("div.action.copy-password", { | ||
tabindex: 0, | ||
title: "Copy password | <Ctrl+C>", | ||
action: "copyPassword", | ||
}), | ||
m("div.action.details", { | ||
tabindex: 0, | ||
title: "Open Details | <Ctrl+O>", | ||
action: "getDetails", | ||
}), | ||
] | ||
); | ||
}) | ||
) | ||
); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we maybe use
&& login.recent.count < 2
? in end end badge count changes only when you have just used a new entry, or when you removed it...