Last active
August 18, 2016 17:15
-
-
Save hogashi/2c25d479af17d1b39eb0098a037a396c to your computer and use it in GitHub Desktop.
show gyazo image on timeline in TweetDeck
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
Array.from(document.getElementsByClassName('url-ext')).map( | |
(v, i) => { | |
if(v.href.match(/https\:\/\/gyazo\.com/)) { | |
divtag1 = document.createElement('div'); | |
divtag1.className = 'js-media media-preview position-rel'; | |
v.parentNode.parentNode.insertBefore(divtag1, v.parentNode.nextSibling); | |
divtag2 = document.createElement('div'); | |
divtag2.className = 'js-media-preview-container position-rel margin-vm'; | |
divtag1.appendChild(divtag2); | |
atag = document.createElement('a'); | |
atag.className = 'js-media-image-link block med-link media-item media-size-medium is-zoomable'; | |
atag.style.backgroundImage = `url(${v.href.replace(/(https.+\.com\/)(.+$)/, 'https://i.gyazo.com/$2.png')})`; | |
atag.href = v.href; | |
atag.target = '_blank'; | |
divtag2.appendChild(atag); | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment