hugolpz / SignItMini

qwe
0 stars 0 forks source link

Clarify minimal structure #1

Open hugolpz opened 4 months ago

hugolpz commented 4 months ago

Draft proposal to discuss. Not sure if they are background script or content script.

├── manifest.json (v.3) — defines extensions and dependencies rights.
├── background.js — main script, imports other background script components.
├── lib/
|   ├── banana-i18n.js
|   └── jquery-3.0.js
├── i18n/
|   ├── qqq.json — UI labels descriptions
|   ├── *.json — UI labels in *
|   └── zh.json — UI labels in Chinese
├── data/
|   ├── ui-languages.js — available signit ui languages with iso, wikidata Qid, English, native labels
|   └── sign-languages.js — available sign languages with videos
├── modal/
|   ├── modal.js — creates above text duo panels "Video | Definition". Imports dictionary.js and gallery.js.
|   ├── dictionary.js — given word, create dictionary panel.
|   └── gallery.js — given urls, creates gallery of videos panel.
├── webpage/
|   └── wikipage.js — on wikimedia sites, if page's title has a sign language video available, then display smartly.
└── popup/
    ├── popup.js — creates top bar SignIt icon's popup, with search, history and settings.
    ├── settings.js —  creates settings tab
    ├── history.js —  creates history tab
    └── search.js — creates search tab. Imports dictionary.js and gallery.js.

Related to background.js : lib, i18n, data. Related to content.js : modal, webpage. Related to popup.js : popup.

hugolpz commented 4 months ago

@kabir-afk hello, i'm thinking about this structure. What do you think ? Does it makes senses to you ?

I think it's complete but i may have forgot things.

Also, dictionary.js panel and gallery.js panel being used by both modal and popup, maybe they should be related to background script, which is available all across the extension.

kabir-afk commented 4 months ago

LGTM! We'll have to add one offscreen.html file as well , as we have to move the DOM and window calls to an offscreen document as per V3. . .guess it'll remain in the root directory as well where background script is available....compartmentalization makes it easier to edit and debug code unlike now, so I guess it is fine

hugolpz commented 4 months ago

@kabir-afk the structure I propose is not definitive. The idea is at least the list all the bricks. Thank you for this idea.

Can you edit directly my issue and add offscreen.js (which suggest the presence of offscreen.html) ? IMO, this should go within folder webpage/ which is kind of a content/ folder with js files editing the dom of the current webpage.

User SaltyKeera also suggested a popup/suggestion.js system but this starts to be out of scope of the "minimal" first phase, IMO.

kabir-afk commented 4 months ago

yea , earlier I was thinking of keeping it in the root dir but since DOM and window calls are limited to content scripts it'll be better to keep it there...but still shouldn't it's scope be global to all three popup , modal and webpage folders? Might be easier to work with . Also it is something unique to chrome updation only , and isn't necessary as well , but as far as I could understand the doc , I think it'll be a useful addition to make the extension more secure and performant.

Also weren't there wpintegration.js and signit.js as well in the content_scripts

Yes I do agree that for a 'minimal' first phase suggestion.js is kinda out of scope but it is a good idea indeed.

hugolpz commented 4 months ago

My current understanding is still limited. I'm learning with ChatGPT too, asking it to explain things to me, and taking notes into my medium :

I will be ready this summer.

In my proposition above :

hugolpz commented 2 months ago

[Deleted 3 out of topic chats on GSoC24]