PinterestPlus
PinterestPlus copied to clipboard
Smart(er) defaults
This PR allows using functions as default values to properties, enabling smart attempts at finding the intended value. There are two examples included, one for data-url
and one for data-image
.
For data-url
the href
of an a
-tag or a nested a
-tag is used. When none is found the document.location.href
.
For data-image
the src
of an img
-tag or a nested img
-tag is used. When none is found an error is generated.
For now, I've only added the functionality to pinterest-plus-html5.js
. If you like the idea, I can extend it everywhere and add demos to the examples.
As a rudimentary example, with the markup below the PinIt-button would get the value of http://foo.com/bar
for data-url
and http://foo.com/baz.jpg
for data-media
.
<div class="pin-it-button">
<a href="http://foo.com/bar"><img src="http://foo.com/baz.jpg"></a>
</div>
Hello Niklas, I like the ideas behind this pull request, and I plan to merge this work. However, I probably wont' have time to get to it until this upcoming weekend.
Cheers, Mike
Cool! Let me know if there's something that you feel is missing. I will gladly patch any shortcomings.
I'm guessing maybe safe to just close and delete this one?
@nikcorg I haven't had to deal with Pinterest APIs for years, so I have no idea whether this library is still useful. If you still use it, I'd be happy to transfer ownership of this repo to you. Otherwise, I'm just going to let it remain "as-is" just in case some old project depends on it.