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);
})()
DansDeals Forum > Amazon & Walmart Deals
Amazon DD Bookmarklet: Have Chrome Make A DDF Friendly Link On Amazon
Dan:
--- Quote from: etech0 on March 02, 2017, 12:10:19 PM ---I just created a bookmarklet that will make a DD link from any amazon item page, and format it with the title so you can paste it into a DDF post.
Here's the code:
--- Code: ---javascript:(function(){
var pattern = new RegExp("(https:\/\/www.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i");
var match = location.href.match(pattern);
var URL = match[1] + "dp/" + match[3] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER";
window.prompt("Press control-c","[url="+URL+"]"+document.title+"[/url]");void(0);
})()
--- End code ---
As a reminder, to create a 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 posted above.
Maybe a mod can add it to this thread: When Posting Amazon Deals, Please Make A DD Link
It might need a little tweaking, so let me know if you have a link that it doesn't work on.
--- End quote ---
aygart:
I think this deserves a HT
stooges44:
--- Quote from: stooges44 on March 03, 2017, 09:13:58 AM ---Used it just now, was awesome, thanks! http://forums.dansdeals.com/index.php?topic=74506.0
--- End quote ---
It's about time!
myi:
@etech0 Really a great piece of art work.
Should be added to the original rules about posting an amazon link.(this is an amazing way to post when your on a computer, especially a computer which is yours.)
While we're still using this simple machine forum layout, I think there should be an amazon link added to one of the buttons(next to the url and img presets.) to allow you to have an amazon link posted and leave you with the Asin to fill in.
(would be amazing to have for those using a mobile phone and for those addicts who will be on ddf from every computer they can get a hold off, which will allow them to post an amazon deal with a click of a button.)
Thanks @Dan
etech0:
--- Quote from: myi on May 18, 2017, 03:44:48 AM ---@etech0 Really a great piece of art work.
--- End quote ---
Thank you
--- Quote from: myi on May 18, 2017, 03:44:48 AM --- While we're still using this simple machine forum layout, I think there should be an amazon link added to one of the buttons(next to the url and img presets.) to allow you to have an amazon link posted and leave you with the Asin to fill in.
(would be amazing to have for those using a mobile phone and for those addicts who will be on ddf from every computer they can get a hold off, which will allow them to post an amazon deal with a click of a button.)
Thanks @Dan
--- End quote ---
+1, especially if it could pull in the product title and an image
Navigation
[0] Message Index
[#] Next page
Go to full version