Skip to content

Commit 4c5c011

Browse files
committed
Converted string concatenations into template literals
1 parent a856302 commit 4c5c011

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

chatgpt-infinity/chromium/extension/popup/controller.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
126126
: toTitleCase(replyLang) )
127127
settings.save('replyLanguage', replyLang || chrome.i18n.getUILanguage())
128-
siteAlert(browserAPI.getMsg('alert_replyLangUpdated') + '!',
128+
siteAlert(`${browserAPI.getMsg('alert_replyLangUpdated')}!`,
129129
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willReplyIn')} `
130130
+ `${ replyLang || browserAPI.getMsg('alert_yourSysLang') }.`
131131
)
@@ -139,11 +139,11 @@
139139
!replyTopic || re_all.test(replyTopic) ? browserAPI.getMsg('menuLabel_all')
140140
: replyTopic)
141141
siteAlert(`${browserAPI.getMsg('alert_replyTopicUpdated')}!`,
142-
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willAnswer')} `
143-
+ ( !replyTopic || re_all.test(replyTopic) ?
144-
browserAPI.getMsg('alert_onAllTopics')
145-
: `${browserAPI.getMsg('alert_onTopicOf')} ${replyTopic}`
146-
) + '!'
142+
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willAnswer')} ${
143+
!replyTopic || re_all.test(replyTopic) ?
144+
browserAPI.getMsg('alert_onAllTopics')
145+
: `${browserAPI.getMsg('alert_onTopicOf')} ${replyTopic}`
146+
}!`
147147
)
148148
}
149149
} else if (entryData.key == 'replyInterval') {
@@ -152,9 +152,10 @@
152152
if (replyInterval == null) return // user cancelled so do nothing
153153
else if (!isNaN(parseInt(replyInterval, 10)) && parseInt(replyInterval, 10) > 4) {
154154
settings.save('replyInterval', parseInt(replyInterval, 10))
155-
siteAlert(browserAPI.getMsg('alert_replyIntUpdated') + '!',
156-
browserAPI.getMsg('appName') + ' ' + browserAPI.getMsg('alert_willReplyEvery')
157-
+ ' ' + replyInterval + ' ' + browserAPI.getMsg('unit_seconds') + '.')
155+
siteAlert(`${browserAPI.getMsg('alert_replyIntUpdated')}!`,
156+
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willReplyEvery')} ${
157+
replyInterval} ${browserAPI.getMsg('unit_seconds')}.`
158+
)
158159
}
159160
}
160161
sync.configToUI({ updatedKey: entryData.key }) ; close() // popup

chatgpt-infinity/firefox/extension/popup/controller.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
127127
: toTitleCase(replyLang) )
128128
settings.save('replyLanguage', replyLang || chrome.i18n.getUILanguage())
129-
siteAlert(browserAPI.getMsg('alert_replyLangUpdated') + '!',
129+
siteAlert(`${browserAPI.getMsg('alert_replyLangUpdated')}!`,
130130
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willReplyIn')} `
131131
+ `${ replyLang || browserAPI.getMsg('alert_yourSysLang') }.`
132132
)
@@ -140,11 +140,11 @@
140140
!replyTopic || re_all.test(replyTopic) ? browserAPI.getMsg('menuLabel_all')
141141
: replyTopic)
142142
siteAlert(`${browserAPI.getMsg('alert_replyTopicUpdated')}!`,
143-
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willAnswer')} `
144-
+ ( !replyTopic || re_all.test(replyTopic) ?
145-
browserAPI.getMsg('alert_onAllTopics')
146-
: `${browserAPI.getMsg('alert_onTopicOf')} ${replyTopic}`
147-
) + '!'
143+
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willAnswer')} ${
144+
!replyTopic || re_all.test(replyTopic) ?
145+
browserAPI.getMsg('alert_onAllTopics')
146+
: `${browserAPI.getMsg('alert_onTopicOf')} ${replyTopic}`
147+
}!`
148148
)
149149
}
150150
} else if (entryData.key == 'replyInterval') {
@@ -153,9 +153,10 @@
153153
if (replyInterval == null) return // user cancelled so do nothing
154154
else if (!isNaN(parseInt(replyInterval, 10)) && parseInt(replyInterval, 10) > 4) {
155155
settings.save('replyInterval', parseInt(replyInterval, 10))
156-
siteAlert(browserAPI.getMsg('alert_replyIntUpdated') + '!',
157-
browserAPI.getMsg('appName') + ' ' + browserAPI.getMsg('alert_willReplyEvery')
158-
+ ' ' + replyInterval + ' ' + browserAPI.getMsg('unit_seconds') + '.')
156+
siteAlert(`${browserAPI.getMsg('alert_replyIntUpdated')}!`,
157+
`${browserAPI.getMsg('appName')} ${browserAPI.getMsg('alert_willReplyEvery')} ${
158+
replyInterval} ${browserAPI.getMsg('unit_seconds')}.`
159+
)
159160
}
160161
}
161162
sync.configToUI({ updatedKey: entryData.key }) ; close() // popup

chatgpt-infinity/greasemonkey/chatgpt-infinity.user.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,9 @@
354354
replyLang.length < 4 || replyLang.includes('-') ? replyLang.toUpperCase()
355355
: toTitleCase(replyLang) )
356356
settings.save('replyLanguage', replyLang || env.browser.language)
357-
modals.alert(( app.msgs.alert_replyLangUpdated ) + '!', // title
358-
( app.msgs.appName ) + ' ' // msg
359-
+ ( app.msgs.alert_willReplyIn ) + ' '
360-
+ ( replyLang || app.msgs.alert_yourSysLang) + '.'
357+
modals.alert(`${app.msgs.alert_replyLangUpdated}!`, // title
358+
`${app.msgs.appName} ${ // msg
359+
app.msgs.alert_willReplyIn} ${ replyLang || app.msgs.alert_yourSysLang }.`
361360
)
362361
}
363362
} else if (key == 'replyTopic') {
@@ -368,21 +367,19 @@
368367
settings.save('replyTopic',
369368
!replyTopic || re_all.test(replyTopic) ? app.msgs.menuLabel_all : replyTopic)
370369
modals.alert(`${app.msgs.alert_replyTopicUpdated}!`,
371-
`${app.msgs.appName} ${app.msgs.alert_willAnswer} `
372-
+ ( !replyTopic || re_all.test(replyTopic) ? app.msgs.alert_onAllTopics
373-
: `${app.msgs.alert_onTopicOf} ${replyTopic}` )
374-
+ '!'
370+
`${app.msgs.appName} ${app.msgs.alert_willAnswer} ${
371+
!replyTopic || re_all.test(replyTopic) ? app.msgs.alert_onAllTopics
372+
: `${app.msgs.alert_onTopicOf} ${replyTopic}` }!`
375373
)
376374
}
377375
} else if (key == 'replyInterval') {
378376
const replyInterval = prompt(`${app.msgs.prompt_updateReplyInt}:`, config.replyInterval)
379377
if (replyInterval == null) return // user cancelled so do nothing
380378
else if (!isNaN(parseInt(replyInterval, 10)) && parseInt(replyInterval, 10) > 4) {
381379
settings.save('replyInterval', parseInt(replyInterval, 10))
382-
modals.alert(( app.msgs.alert_replyIntUpdated ) + '!', // title
383-
( app.msgs.appName ) + ' ' // msg
384-
+ ( app.msgs.alert_willReplyEvery ) + ' '
385-
+ replyInterval + ' ' + ( app.msgs.unit_seconds ) + '.'
380+
modals.alert(`${app.msgs.alert_replyIntUpdated}!`, // title
381+
`${app.msgs.appName} ${ // msg
382+
app.msgs.alert_willReplyEvery} ${replyInterval} ${app.msgs.unit_seconds}.`
386383
)
387384
}
388385
}

0 commit comments

Comments
 (0)