Code Monkey home page Code Monkey logo

Comments (2)

dteviot avatar dteviot commented on July 18, 2024

@bonnetchuu

Interesting. Looks like what they've done is :

  1. Take the original paragraphs
  2. Then add in lots of other paragraphs and spans. The original text remains, but it's buried in the "noise".
  3. Tag the noise in various ways, so browser hides it when viewing site normally. There are at least two mechanisms.
    3.1 Have an attribute of aria-hidden='true'
    3.2 Javascript list of classes to hide. Although it looks like the wanted paragraphs all contain a br element.

So, the following EpubEditor script will remove nearly all the noise.

            for(let p of [...dom.querySelectorAll("span[aria-hidden='true']")]) {
                    p.remove();
            }

            for(let p of [...dom.querySelectorAll("p")]) {
                if (p.querySelector("br") === null) {
                    p.remove();
                }
            }
            return true;

Note:

  1. It doesn't fix the random author/translator note.
  2. Footnotes are still mixed in with the text. They have a class of "tooltiptext" so could be ripped out.
    Actually migrating them to footnotes at bottom of page would require a more complex script

Tested with https://www.cntranslations.com/p/the-long-road-ahead.html, Chapters 1 and 2
For my notes: 58 minutes work

from webtoepub.

bonnetchuu avatar bonnetchuu commented on July 18, 2024

Thank you very much!! This fixed the issue really well! :D

from webtoepub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.