dteviot / WebToEpub

A simple Chrome (and Firefox) Extension that converts Web Novels (and other web pages) into an EPUB.
Other
676 stars 132 forks source link

Parser override function similar to the current Options export and import #1379

Open Hogesyx opened 1 month ago

Hogesyx commented 1 month ago

It would be easier for user to either have a textbox to modify the existing loaded parser or to allow exporting or importing js file. This allow advance user to quickly modify and test out parser profiles.

dteviot commented 1 month ago

@Hogesyx

textbox to modify the existing loaded parser or to allow exporting or importing js file.

Please provide more details. Modify what? How?

Hogesyx commented 1 month ago

@Hogesyx

textbox to modify the existing loaded parser or to allow exporting or importing js file.

Please provide more details. Modify what? How?

Hi David, you are responsive as always.

As of right now with my limited understanding of the way the main code handles parser js. I believe there is no easy way to integrated this as the program basically scan through the entire list of parser and see which matches.

I was wondering rather than this behavior and the never ending requirement to update parser js manually for things like encoding and url, is there a better way for the application to handle this so that you are not overloaded with approving minor stuff such as url change commits. So rather than loading the js file once it matches, it could be buffered as a string for advance user to modify before it is being loaded into the main application, or alternate way to handle site profiles that can be easily modify for advance users that does not want to run their browser in developer mode.

dteviot commented 1 month ago

@Hogesyx

My initial thought is to point you at https://github.com/dteviot/WebToEpub/issues/1353.

That said, what is the actual pain point your trying to fix?

you are not overloaded with approving minor stuff such as url change commits.

This isn't a problem for me at the moment. (Aside, things will get more interesting on Sept 10th when Satisfactory 1.0 drops)

Anyway, providing a UI in W2E to allow users to type code will have same problem as #1353, having dynamic code supplied that Google/Mozilla have not validated is a big no-no, even if a user is typing it in themselves.

That said, it looks like it could be done via Chrome's console tab under devtools. See: https://developer.chrome.com/docs/devtools/console/javascript.

Use case would be something like:

  1. Open W2E
  2. Open Console
  3. Insert Code into REPL
  4. Invoke Command into W2E to try selecting parser again. (Note this would need to be added.)

Complications are:

  1. W2E selects parser on opening or reloading. On Reload, anything in REPL would be lost. So, need to add 4 above.
  2. Also, not sure how useful having to reload into REPL for each time you open W2E would be.
Kiradien commented 1 month ago

As of right now with my limited understanding of the way the main code handles parser js. I believe there is no easy way to integrated this as the program basically scan through the entire list of parser and see which matches.

The other things he mentioned might be troublesome for the same reasons as #1353, but... Maybe not this one? It wouldn't involve a permanent change to the code or running any code that is not validated, but I imagine a button could be created that creates an instance of every Parser to run getChapterUrls and return a count...

Sorted list pops up, user can select top one.

From there, parserFactory.register it and reload the interface... The only part I'm not sure about is reloading the interface logic without cleaning new registration.