Source code for the Pin It button (pinterest.com)

Does anyone have an idea on how to implement something like a "PIN" button on pinterest.com? From a high level, I understand what he does, but not in detail. You click on the "pin it" tab, and then clear the source code of the site to find out images with a width and height that exceed a certain threshold. An image source page scraper can occur on the client side or server side. What is the best way to achieve something like this?

Can someone take a look at their implementation?

+5
source share
2 answers

In fact, such bookmarks usually do this:

, JavaScript, URL-:

javascript: void((function () { SOME_CODE })());

SOME_CODE. Pin it :

javascript: void((function () {
    var e = document.createElement('script');
    e.setAttribute('type', 'text/javascript');
    e.setAttribute('charset', 'UTF-8');
    e.setAttribute('src', 'http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random() * 99999999);
    document.body.appendChild(e)
})());

. Pin "pinmarklet.js". , "? R = '+ Math.random() * 99999999" .

, , JavaScript. DOM , (Images, Video Links,...) .

, : -)

+1

javacript pinterest, , .

: https://github.com/mustaine/Pinmarklet

, .

+1

All Articles