Git Product home page Git Product logo

Comments (5)

fb55 avatar fb55 commented on August 15, 2024

That's the nice thing when you've got a rendered page: You may simply remove everything that isn't visible (for jQuery users: $(":not(:visible)").remove()).

I can't tell by looking at the markup which parts will be hidden, so I'm closing this as I don't see a way to fix it.

from readabilitysax.

mrjjwright avatar mrjjwright commented on August 15, 2024

Well what about this in onclosetag? The idea here would be to only allow one image per level in the readable article. I tested this and it works well on NPR articles except it doesn't remove duplicate captions.

if (tagName === 'img') {
  // don't double up on showing  images
  if (this._imgElem) {
    elem.parent.isCandidate = false;
    // skip the img
    return;
}
  else this._imgElem = elem.parent;   
}

if (this._imgElem === elem) {
  this._imgElem = null;
}

from readabilitysax.

fb55 avatar fb55 commented on August 15, 2024

This would solve this particular problem, but would raise others: Just think about image galeries. And I've seen websites that wrapped their content in <pre> tags, with image tags at random locations. I don't want to break these, even though their markup is terrible. But you may argue the same for npr.org.

Besides, isCandidate only signals that an element is a candidate for being the container of the article ;)

from readabilitysax.

fb55 avatar fb55 commented on August 15, 2024

Okay, first, you should use a label for this code. The boolean isn't needed and complicates everything. Besides, you remove all nodes that aren't <img>s, which isn't such a good idea.

I guess the best variant would be to filter images based on their URLs, in a similar way as links are already handled. When you find some usable rules for comparing URLs, that would be great.

from readabilitysax.

mrjjwright avatar mrjjwright commented on August 15, 2024

I got rid of that code.

I instead keep track of the largest image within each div and if the div is too low on contentLength simply use that image as the div's children. This is taking care of enlarge divs and the like. I filter out anything with slideshow explicitly. It's working well.

On Aug 24, 2012, at 5:32 AM, Felix BΓΆhm [email protected] wrote:

Okay, first, you should use a label for this code. The boolean isn't needed and complicates everything. Besides, you remove all nodes that aren't s, which isn't such a good idea.

I guess the best variant would be to filter images based on their URLs, in a similar way as links are already handled. When you find some usable rules for comparing URLs, that would be great.

β€”
Reply to this email directly or view it on GitHub.

from readabilitysax.

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.