changeset 28:aa50069d6371

(none)
author Edho Arief <me@myconan.net>
date Tue, 17 Nov 2015 14:01:36 +0000
parents 2a4e34183b01
children d467e1e0ec98
files tweetdeck-large-image.user.js
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tweetdeck-large-image.user.js	Tue Nov 17 12:24:37 2015 +0000
+++ b/tweetdeck-large-image.user.js	Tue Nov 17 14:01:36 2015 +0000
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name         Tweetdeck large image
 // @namespace    https://myconan.net
-// @version      1.0.0
+// @version      1.0.1
 // @description  No more stupid link for images in tweetdeck
 // @author       nanaya
 // @match        https://tweetdeck.twitter.com/*
@@ -17,7 +17,14 @@
     var link = e.currentTarget;
     if (link._ecUserscript === true) { return; }
     
-    var url = getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)(:small)?\1\)$/, '$2');
+    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;
   });