Mercurial > ec-userscripts
view tweetdeck-large-image.user.js @ 32:41953e59d06f
(none)
author | Edho Arief <me@myconan.net> |
---|---|
date | Sat, 24 Dec 2016 04:41:13 +0000 |
parents | aa50069d6371 |
children | 28505554a8b9 |
line wrap: on
line source
// ==UserScript== // @name Tweetdeck large image // @namespace https://myconan.net // @version 1.0.1 // @description No more stupid link for images in tweetdeck // @author nanaya // @match https://tweetdeck.twitter.com/* // @grant none // @downloadURL https://bitbucket.org/!api/2.0/snippets/nanaya1/TK64/tip/files/tweetdeck-large-image.user.js // ==/UserScript== ;(function() { var $ = jQuery; $(document).off('.ec-userscript'); $(document).on('mouseenter.ec-userscript', '.js-media-image-link', function(e) { var link = e.currentTarget; if (link._ecUserscript === true) { return; } var images = link.getElementsByClassName('media-img'); var url; if (images.length) { url = images[0].src.replace(/:[a-z0-9]+$/, ''); } else { url = getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)(:small)?\1\)$/, '$2'); } link.setAttribute('href', url + ':orig'); link._ecUserscript = true; }); }).call();