I added the Pinterest hover module and the assets.pinterest script that is added via that module hijacks the link and converts it to the "pin it" button that shows when hovering images. This was annoying and took awhile to figure out.

Anyways, the solution for me was the following from stack overflow question:

Adding an encoded whitespace before the last fragment of the URL will prevent Pinterest's JS from "hijacking" the link:

Change line #296 in rrssb.module from this:

'pinterest' => '<a href="http://pinterest.com/pin/create/button/?url=' . $my_url . '&amp;media=' . $logo .'&amp;description=' . urlencode($my_title) . '" class="popup">

to this:

'pinterest' => '<a href="http://pinterest.com/pin/create%2Fbutton/?url=' . $my_url . '&amp;media=' . $logo .'&amp;description=' . urlencode($my_title) . '" class="popup">

Notice, all we change is the forward slash convention (%2f) so pinterest's script doesn't override.

//pinterest.com/pin/create<strong>%2F</strong>button/?url=

Hopefully this helps someone else out. If module maintainer doesn't see problem with this it would be nice to add.

Thanks!

Comments

cthshabel created an issue. See original summary.

adamps’s picture

Thanks, sounds like a good idea to me.

The ideal way for you to present a code idea for a module is in the form of a patch - see https://www.drupal.org/node/707484.

I would suggest adding a code comment explaining why: "Adding an encoded whitespace before the last fragment of the URL will prevent Pinterest's JS from "hijacking" the link:"

mist’s picture

+1 Thanks for good advice. Patch below.

mist’s picture

I think something was wrong with my previous patch.

adamps’s picture

Status: Needs review » Needs work

Thanks for your continuing interest. I think what is needed next is

  • Patches need to be made against dev not stable. The difference is pretty big right now!
  • Please add the comment to explain why as I suggested.
giorgosk’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.11 KB

Patched for the latest dev version
its a trivial patch and it works for me @cthshabel and @mist
so I mark it reviewed and tested by the community

adamps’s picture

Status: Reviewed & tested by the community » Needs work

Thanks please add comment as per #2 then happy to commit

giorgosk’s picture

I don't know the exact comment you want so I will leave it as is

adamps’s picture

Status: Needs work » Fixed

  • AdamPS committed 6ff3ca3 on 7.x-1.x
    Issue #2566647 by mist, GiorgosK, AdamPS: Pin it hover image script...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.