diff --git a/scripts/GUI/user_actions.js b/scripts/GUI/user_actions.js deleted file mode 100644 index 63f9e59..0000000 --- a/scripts/GUI/user_actions.js +++ /dev/null @@ -1,7 +0,0 @@ -export default class user_actions { - static init() { - chrome.sidePanel - .setPanelBehavior({ openPanelOnActionClick: true }) - .catch((error) => console.error(error)); - }; -}; \ No newline at end of file diff --git a/scripts/actions/tabs.js b/scripts/actions/tabs.js new file mode 100644 index 0000000..35f00a4 --- /dev/null +++ b/scripts/actions/tabs.js @@ -0,0 +1,14 @@ +import Tabs from "/scripts/GUI/tabs.js"; +import Entry from "/scripts/external/entry.js" + +export default class Watcher_Tabs { + constructor () { + Tabs.addActionListener(`update`, this.check); + }; + + check(data) { + if ((data.tab) ? data.tab.url : false) { + Entry.manage(data.tab); + } + } +} \ No newline at end of file diff --git a/scripts/actions/user_actions.js b/scripts/actions/user_actions.js new file mode 100644 index 0000000..9438d6b --- /dev/null +++ b/scripts/actions/user_actions.js @@ -0,0 +1,9 @@ +import Watcher_Tabs from "./tabs.js"; + +export default class user_actions { + static init() { + chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch((error) => console.error(error)); + + new Watcher_Tabs(); + }; +}; \ No newline at end of file diff --git a/scripts/shopAI.js b/scripts/shopAI.js index 3e15a09..1917881 100644 --- a/scripts/shopAI.js +++ b/scripts/shopAI.js @@ -3,7 +3,7 @@ Shop wisely with AI! */ import fc from './fc.js'; -import user_actions from "./GUI/user_actions.js"; +import user_actions from "./actions/user_actions.js"; fc.run(); user_actions.init(); \ No newline at end of file