lazyload icon indicating copy to clipboard operation
lazyload copied to clipboard

Fetch image original either from data-original, or content or contentUrl attr

Open PMPP opened this issue 9 years ago • 9 comments

As microformats keep gaining traction, having attributes that describe better the page, and its information, becomes more and more relevant.

Many "objects" (movie, product, person, etc) can have a photo, which can be tag as itemprop="image". Normally if the element is an IMG the parser would refer to the SRC to know the content of that property. Since with lazy loading we lack that, other attributes can be used: content or contentUrl.

To avoid duplication of one could assume that a missing data-original implies the usage of content, or contentUrl to fetch the original image.

Thoughts?

PMPP avatar Mar 25 '15 10:03 PMPP

:+1:

nicodemuz avatar Mar 25 '15 10:03 nicodemuz

That is a good idea +:100:

giver avatar Mar 25 '15 10:03 giver

i agree, :+1:

devzer01 avatar Mar 25 '15 10:03 devzer01

Rebuilt the min assets to solve conflict.

PMPP avatar Apr 07 '15 02:04 PMPP

Thanks. As mentioned in CONTRIBUTING should not include minified version in pull request. These are handled by the building process. No need to remove though. I can cherrypick around it if I decide to include this.

I like the idea of supporting microformats. For me the problem is the attribute names are hardcoded. Next year there will be a new microformat which uses different attribute name. More hardcoded logic needed. It would be better if the attribute name was configurable. This way user can use any arbitrary attribute name he or she chooses.

Since there already is data_attribute parameter this cannot be changed without breaking bc. One option would be to add attribute parameter which overrides data_attribute if the first one exists. Basically just resolve in constructor what the attribute name will be and use simple $.attr() in rest of the code.

$.attr() is anyway used already because it is faster than $.data() and does not cache the results.

tuupola avatar Apr 07 '15 06:04 tuupola

Good point, I'll refactor once I get the opportunity and came for your appreciation. By that point I'll also remove the minified commit. Thanks for taking a look into this.

PMPP avatar Apr 07 '15 06:04 PMPP

I've updated the PR, there for your consideration. Thanks!

PMPP avatar May 28 '15 02:05 PMPP

Ping?

PMPP avatar Jul 30 '15 04:07 PMPP

@tuupola can this be merged in?

nicodemuz avatar Mar 01 '16 07:03 nicodemuz