Skip to content

Commit cf79f9d

Browse files
committed
Renamed UI sync function to align w/ my ChatGPT extensions ↞ [auto-sync from https://github.com/KudoAI/chatgpt.js-chrome-starter]
1 parent 4cb4d1d commit cf79f9d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

starters/chrome/extension/content.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
chrome.runtime.onMessage.addListener(req => {
1515
if (req.action == 'notify') notify(req.msg, req.pos)
1616
else if (req.action == 'alert') siteAlert(req.title, req.msg, req.btns)
17-
else if (req.action == 'syncStorageToUI') syncStorageToUI()
17+
else if (req.action == 'syncconfigToUI') syncconfigToUI()
1818
})
1919

2020
// Init CONFIG
@@ -48,7 +48,7 @@
4848

4949
// Define SYNC function
5050

51-
async function syncStorageToUI() { // on toolbar popup toggles + ChatGPT tab activations
51+
async function syncconfigToUI() { // on toolbar popup toggles + ChatGPT tab activations
5252
await settings.load('extensionDisabled', Object.keys(settings.controls)) // load from Chrome storage to content.js config
5353
if (config.extensionDisabled) {
5454
// Remove all hacks

starters/chrome/extension/popup/controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
})
4444
},
4545

46-
storageToUI(options) { return sendMsgToActiveTab('syncConfigToUI', options) }
46+
configToUI(options) { return sendMsgToActiveTab('syncConfigToUI', options) }
4747
}
4848

4949
// Run MAIN routine
@@ -96,7 +96,7 @@
9696
menuInput.onclick = menuSlider.onclick = event => // prevent double toggle
9797
event.stopImmediatePropagation()
9898
menuInput.onchange = () => {
99-
settings.save(key, !config[key]) ; sync.storageToUI()
99+
settings.save(key, !config[key]) ; sync.configToUI()
100100
notify(`${settings.controls[key].label} ${ /disabled|hidden/i.test(key) != config[key] ? 'ON' : 'OFF' }`)
101101
}
102102
} else if (settings.controls[key].type == 'prompt') {

starters/chrome/extension/service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ chrome.runtime.onInstalled.addListener(details => {
1818

1919
// Sync settings to activated tabs
2020
chrome.tabs.onActivated.addListener(activeInfo =>
21-
chrome.tabs.sendMessage(activeInfo.tabId, { action: 'syncStorageToUI' }))
21+
chrome.tabs.sendMessage(activeInfo.tabId, { action: 'syncconfigToUI' }))

0 commit comments

Comments
 (0)