File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -28,25 +28,24 @@ function notify ({ didSucceed, operation }) {
2828}
2929
3030function genInfo ( didSucceed , operation ) {
31- const index = getIndex ( )
3231 const operationText = operation === MERGE ? 'Merge' : 'Conversion'
3332
3433 if ( didSucceed ) {
3534 return {
3635 title : `${ operationText } complete!` ,
37- body : text . success [ index ] ,
36+ body : getRandomElement ( text . success ) ,
3837 icon : `${ imgPath } /success.png`
3938 }
4039 }
4140
4241 return {
4342 title : `Oh no! ${ operationText } failed.` ,
44- body : text . failure [ index ] ,
43+ body : getRandomElement ( text . failure ) ,
4544 icon : `${ imgPath } /failure.png`
4645 }
4746}
4847
49- function getIndex ( ) {
48+ function getRandomElement ( array ) {
5049 const rnd = Math . random ( )
51- return Math . floor ( rnd * text . messageCount )
50+ return array [ Math . floor ( rnd * array . length ) ]
5251}
Original file line number Diff line number Diff line change 11{
2- "messageCount" : 5 ,
32 "success" : [
43 " Your images are done a'brewin." ,
54 " The transmutation was a success." ,
1413 " Another deception of the photo sorcerer." ,
1514 " The night is dark and full of terrors."
1615 ]
17- }
16+ }
You can’t perform that action at this time.
0 commit comments