Created
May 1, 2016 09:23
-
-
Save cotcotquedec/4de57a4f97a103acca029a0307f75d20 to your computer and use it in GitHub Desktop.
Extract link from photo and video on 9gag and create a button with the link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('article.badge-entry-container:not(".link-ok")').each(function(){$(this).find("video").length>0?$(this).addClass("link-ok").append("<a class='btn' style='margin:5px' target='_blank' href='"+$(this).find("div.badge-animated-container-animated").data("mp4")+"'>Lien video</a>"):$(this).find("img").length>0&&$(this).addClass("link-ok").append("<a class='btn' style='margin:5px' target='_blank' href='"+$(this).find("img").attr("src")+"'>Lien image</a>")}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Execute code in the console and let the magic happen