Topic Wiki

UPDATE:
@JoeyShmoe did a great job creating a Chrome Extension and a Firefox Extension to save us all the hassle of setting up a bookmarklet. The extension will place a button on any Amazon product page. When you click the button it will copy a link to your clipboard, which you can paste into any DDF post. The post will then contain the product title, image, and a working link to the product.

Thanks @JoeyShmoe!

---

For anyone who doesn't want to install a browser extension, read below how to set up the bookmarklet:

Here is a bookmarklet that will make a DD link from any amazon item page, and format it with the title and an image so you can paste it into a DDF post.

Example:

Little Tikes Rocking Horse Magenta ($34.07)



(Not sure what a bookmarklet is? Read more about them in this thread: http://forums.dansdeals.com/index.php?topic=61269.5.)

Here's how to install the bookmarklet:

1. If you don't currently see a row of bookmarks on the top of your browser, you will need to show the bookmarks bar.
- In Chrome, click the 3 vertical dots at the top right of your screen, click Settings, and click Always Show the Bookmarks Bar.
- In Firefox, click the 3 horizontal lines at the top right of your screen, and click Customize. Then click Show/Hide Toolbars (bottom left of your screen) and check off the Bookmarks Toolbar.

2. Copy the following code. (To do so, click the SELECT button and then press control-c on your keyboard.)
Code: [Select]
javascript: (function() {
    var pattern = new RegExp("(https:\/\/www.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*|(https:\/\/smile.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i"),
        match = location.href.match(pattern),
        image = document.getElementById('landingImage').src;
    var price = "";
    if (document.getElementById('priceblock_dealprice') !== null) {
        price = " (" + document.getElementById('priceblock_dealprice').innerHTML + ")";
    } else if (document.getElementById('priceblock_ourprice') !== null) {
        price = " (" + document.getElementById('priceblock_ourprice').innerHTML + ")";
    }
    var URL = (match[1] !== undefined) ? match[1] + "dp/" + match[3] + "/?tag=cl03f-20&smid=ATVPDKIKX0DER" : match[4] + "dp/" + match[6] + "/?tag=cl03f-20&smid=ATVPDKIKX0DER";
    var result = "[url=" + URL + "]" + document.title + price + "[/url][br][br][url=" + URL + "][img]" + image + "[/img][/url]";
    if (document.execCommand('copy') !== false) {
        var ddLink = document.createElement('span'),
            range = document.createRange();
        ddLink.id = "ddLink";
        ddLink.innerText = result;
        document.body.appendChild(ddLink);
        range.selectNode(document.getElementById('ddLink'));
        window.getSelection().addRange(range);
        document.execCommand('copy');
        document.getElementById('ddLink').remove();
        setTimeout(function() {
            alert('DD link copied to clipboard...')
        }, 1000);
    } else {
        window.prompt("Press control-c", result);
    }
    void(0);
})()

3. To create the bookmarklet, right click on your bookmarks bar and click "Add page" (if you're in Chrome) or "New bookmark" (Firefox).

For the Name, enter whatever you want (eg: Dan Amazon link), and for the URL/Location enter the code above, which you already copied.

4. Click Save (Chrome) or Add (Firefox)

To use the bookmarklet, simply click on the bookmark you created (in step 3) when you are on any amazon product page. Follow the prompts (you may need to press control-c to copy what pops up), and then paste it into any DDF post.

Enjoy!

Disclaimer: The code might need a little tweaking, so let me know if you have a link that it doesn't work on. If there are any changes I will update the wiki.

Author Topic: Amazon DD Bookmarklet: Have Chrome Make A DDF Friendly Link On Amazon  (Read 9631 times)

Online JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 980
  • Total likes: 40
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
3 as DD gives tzedaka on earnings as well :)
Thanks for your support!
Sweet! Now I have to make sure my wife doesn't find out how much Tzedakah she can do by shopping on Amazon :P
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline Dan

  • Administrator
  • Dansdeals Lifetime 40K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 47902
  • Total likes: 659
  • DansDeals.com Hat Tips 15685
  • Gender: Male
    • View Profile
  • Location: CLE
  • Programs: UA Global Services, AA Lifetime Plat, DL Dirt, SPG Plat, Hyatt Diamond, Fairmont Lifetime Plat, Hilton Diamond, Priority Club Plat, Avis Chairman, National EE, Hertz PC
Sweet! Now I have to make sure my wife doesn't find out how much Tzedakah she can do by shopping on Amazon :P
;D ;D ;D
Save your time, I don't answer PM. Post it in the forum and a dedicated DDF'er will get back to you as soon as possible.

Online etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8601
  • Total likes: 138
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Workflowy. You won't know what you're missing until you try it.

Online etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8601
  • Total likes: 138
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
To further complicate things below is an updated version of the code. 2 differences from my previous code 1) it checks whether you're on smile.amazon.com or www.amazon.com and generates the appropriate link (should only be used once @Dan confirms that he gets commission on those links), 2) if your browser allows to copy via Javascript, it'll do so automatically, no need to Ctrl + c.
Sorry, I enjoy playing with Javascript too much :)
So cool! Now I know who to bother when I need JS help :)

The version that automatically copies the link to the clipboard doesn't seem to be pulling in the images for me. Does it work for you?
Workflowy. You won't know what you're missing until you try it.

Online JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 980
  • Total likes: 40
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
So cool! Now I know who to bother when I need JS help :)

The version that automatically copies the link to the clipboard doesn't seem to be pulling in the images for me. Does it work for you?
I'll be happy to answer any and all JS questions you have :)

Worked for me, I didn't change the part that you wrote to generate the code, only the part that shows the prompt.

AmazonSmile: Citizen Men's BM8434-58A Eco-Drive WR100 Sport Watch: Citizen: Watches ($93.75)

DDF A-Z Link Extension
Chrome
Firefox
Info

Online stooges44

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Jan 2017
  • Posts: 3411
  • Total likes: 175
  • DansDeals.com Hat Tips 154
    • View Profile

Online etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8601
  • Total likes: 138
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
I just tried again and this time it worked. I think it only works if the page is fully loaded when you click the bookmarklet.

Meanwhile, I tried clicking the watch (above) and it didn't work. Does it work for you? If not we might have to tweak the regex.
Workflowy. You won't know what you're missing until you try it.

Online stooges44

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Jan 2017
  • Posts: 3411
  • Total likes: 175
  • DansDeals.com Hat Tips 154
    • View Profile
I just tried again and this time it worked. I think it only works if the page is fully loaded when you click the bookmarklet.

Meanwhile, I tried clicking the watch (above) and it didn't work. Does it work for you? If not we might have to tweak the regex.

https://smile.amazon.com/dp/undefined/?tag=cl03f-20&smid=ATVPDKIKX0DER

Offline hide4

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2015
  • Posts: 1033
  • Total likes: 15
  • DansDeals.com Hat Tips 0
    • View Profile
  • Location: NY-Israel
I just tried again and this time it worked. I think it only works if the page is fully loaded when you click the bookmarklet.

Meanwhile, I tried clicking the watch (above) and it didn't work. Does it work for you? If not we might have to tweak the regex.
Meeting dogs

Online JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 980
  • Total likes: 40
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
I just tried again and this time it worked. I think it only works if the page is fully loaded when you click the bookmarklet.

Meanwhile, I tried clicking the watch (above) and it didn't work. Does it work for you? If not we might have to tweak the regex.
https://smile.amazon.com/dp/undefined/?tag=cl03f-20&smid=ATVPDKIKX0DER
Yep, working on it, I'm gonna need a minute
DDF A-Z Link Extension
Chrome
Firefox
Info

Online JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 980
  • Total likes: 40
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Working now

Code: [Select]
javascript:(function(){
  var pattern = new RegExp("(https:\/\/www.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*|(https:\/\/smile.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i"),
      match = location.href.match(pattern),
      image = document.getElementById('landingImage').src,
      price = document.getElementById('priceblock_ourprice').innerHTML,
      URL = (match[1] !== undefined) ? match[1] + "dp/" + match[3] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER": match[4] + "dp/" + match[6] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER",
      result = "[url="+URL+"]"+document.title+" [b]("+price+")[/b][/url][br][br][url="+URL+"][img]"+image+"[/img][/url]";
  if(document.execCommand('copy') !== false) {
    var ddLink = document.createElement('span'),
        range = document.createRange();
    ddLink.id = "ddLink";
    ddLink.innerText = result;
    document.body.appendChild(ddLink);
    range.selectNode(document.getElementById('ddLink'));
    window.getSelection().addRange(range);
    document.execCommand('copy');
    document.getElementById('ddLink').remove();
    setTimeout(function() {alert('DD link copied to clipboard...')}, 1000);
  } else {
    window.prompt("Press control-c",result);
  }
  void(0);
})()

AmazonSmile: Citizen Men's BM8434-58A Eco-Drive WR100 Sport Watch: Citizen: Watches ($93.75)

« Last Edit: June 14, 2017, 11:49:17 AM by JoeyShmoe »
DDF A-Z Link Extension
Chrome
Firefox
Info

Online etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8601
  • Total likes: 138
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Works, thanks! I will update the wiki now.
Workflowy. You won't know what you're missing until you try it.

Offline mileagejunkie

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Nov 2014
  • Posts: 2286
  • Total likes: 93
  • DansDeals.com Hat Tips 170
  • Gender: Male
    • View Profile
  • Location: NYC
  • Programs: Too many to list
Works, thanks! I will update the wiki now.

Works on Safari too, just need to create a bookmark for any webpage and then edit the address and put the code instead.
Doc in training by day, frequent flyer by night.

Online myi

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Feb 2015
  • Posts: 9069
  • Total likes: 388
  • DansDeals.com Hat Tips 151
    • View Profile
  • Location: brklyn/Israel
You guys are amazing, really great work.
 Better late then ever, finally get to see the price and items of the product when click on the deal link, without having to click on the amazon link, nor leave some comments where's the price? Or why is the link not correct, or the like.
 Amazing work @etech0 and to @JoeyShmoe for all the little tweaking.
Don't try to be someone else , be who you are because everyone else is taken.

Online etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8601
  • Total likes: 138
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
https://www.amazon.com/dp/B00D3KJN48?psc=1
 
 @etech0 cant get this to work with your bookmark??
Weird! @JoeyShmoe any idea why? It seems to work with the original bookmarklet, but not with our final version.
Workflowy. You won't know what you're missing until you try it.