view tweetdeck-large-image.user.js @ 25:06d7972287c1

(none)
author Edho Arief <me@myconan.net>
date Tue, 17 Nov 2015 11:01:09 +0000
parents 8ce6738a3a81
children 6ff29abe127d
line wrap: on
line source

// ==UserScript==
// @name         Tweetdeck large image
// @namespace    https://myconan.net
// @version      1.0.0
// @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/jiku-chu-direct-link.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 url = getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)(:small)?\1\)$/, '$2');
    link.setAttribute('href', url + ':orig');
    link._ecUserscript = true;
  });
}).call();