Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in pinterest handler #11

Closed
nborko opened this issue Aug 15, 2018 · 1 comment
Closed

Error in pinterest handler #11

nborko opened this issue Aug 15, 2018 · 1 comment
Assignees

Comments

@nborko
Copy link
Contributor

nborko commented Aug 15, 2018

If the pinistrify function, handlePinterestEmbed makes this check:

embedo/embedo.js

Line 1593 in 46c7821

} else if (pinterest_embed_timer >= 100) {

pinterest_embed_timer is an interval ID, so you'll always get an error, even if the embed is successful, if the ID pool is over 100 (pretty common, especially in SPA).

I'm not sure what this is supposed to be checking, but even if you use a counter here instead, 100 * 250ms (25 seconds) seems too long. Something like 20, or 5s total, would be more reasonable.

Also, I'm reasonably certain that the setInterval call here:

embedo/embedo.js

Line 1578 in 46c7821

var pinterest_embed_timer = setInterval(handlePinterestEmbed, 250);

should be inside the setTimeout after the if block containing the PinUtils.build call:

embedo/embedo.js

Lines 1580 to 1584 in 46c7821

setTimeout(function () {
if (!childNode.querySelector('[data-pin-href]')) {
window.PinUtils.build(childNode);
}
}, 750);

(after line 1583)

My changes here https://github.com/nborko/embedo/blob/865fcbe1da62467a333d31838541c39861294c48/embedo.js#L1578-L1598 work for me, please let me know if you'd like a PR.

thanks,
Nick

@shobhitsharma shobhitsharma self-assigned this Aug 15, 2018
@shobhitsharma
Copy link
Owner

@nborko Hi Nick, thanks for the issue and PR mate. I checked and merged it. Looks fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants