-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
feat: corruption loadout import/export #114
base: master
Are you sure you want to change the base?
feat: corruption loadout import/export #114
Conversation
Oh, I didn't think of it. I might just make the whole corruption cell clickable instead, with a tooltip at the bottom. Thanks! |
@@ -201,10 +201,15 @@ export const corruptionLoadoutTableCreate = () => { | |||
} | |||
if (i === 0) { | |||
let cell = row.insertCell(); | |||
//empty | |||
let btn = document.createElement("button"); |
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.
const
let btn = document.createElement("button"); | ||
btn.className = "corrSave" | ||
btn.textContent = "Import" | ||
btn.onclick = () => corruptionLoadoutImportPrompt(); |
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.
addEventListener
|
||
cell = row.insertCell(); | ||
let btn = document.createElement("button"); | ||
btn = document.createElement("button"); |
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.
rename
[ | ||
'Please enter comma-separated corruption values. Current loadout:', | ||
player.prototypeCorruptions.join(','), | ||
].join('\n') |
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.
just concat the strings
return Alert('Invalid format! Corruption loadouts should be 13 comma-separated numbers.'); | ||
} | ||
|
||
player.prototypeCorruptions = importLoadout; |
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.
what if one of these is NaN, negative, infinite, etc?
|
||
cell = row.insertCell(); | ||
let btn = document.createElement("button"); | ||
btn = document.createElement("button"); | ||
btn.className = "corrLoad" | ||
btn.textContent = "Zero" | ||
btn.onclick = () => corruptionLoadoutSaveLoad(false, i); |
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.
please addEventListener here too
player.prototypeCorruptions = importLoadout; | ||
corruptionLoadoutTableUpdate(); | ||
corruptionStatsUpdate(); | ||
}; |
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.
remove semicolon
|
||
export const copyToClipboard = async (text: string) => { | ||
if ('clipboard' in navigator) { | ||
await navigator.clipboard.writeText(text) |
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.
return void navigator.clipboard...
await navigator.clipboard.writeText(text) | ||
.catch(e => console.error(e)); | ||
|
||
return; |
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.
axe this return
@@ -102,3 +102,27 @@ export const btoa = (s: string) => { | |||
return null; | |||
} | |||
} | |||
|
|||
export const copyToClipboard = async (text: string) => { |
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.
: Promise
Minor refactor: move "Copy to clipboard" save export feature to a new
copyToClipboard
functionFixes #113