# HG changeset patch # User nanaya # Date 1557592244 -32400 # Node ID 753765f3814ec915988985167993e1bfc10685cc # Parent cd3ffdc3161357a267cdd69fa9562a800101149a Not sure why but sometimes link style is null? diff -r cd3ffdc31613 -r 753765f3814e tweetdeck-large-image.user.js --- a/tweetdeck-large-image.user.js Sun May 05 22:36:10 2019 +0900 +++ b/tweetdeck-large-image.user.js Sun May 12 01:30:44 2019 +0900 @@ -1,7 +1,7 @@ // ==UserScript== // @name Tweetdeck large image // @namespace https://myconan.net -// @version 2.0.2 +// @version 2.0.3 // @description No more stupid link for images in tweetdeck // @author nanaya // @match https://tweetdeck.twitter.com/* @@ -46,10 +46,17 @@ var image = link.querySelector(".media-img"); var url; + // sometimes the image is just background image of the link. + // strip all query strings and original :size suffix if (image == null) { - // sometimes the image is just background image of the link. - // strip all query strings and original :size suffix - url = getComputedStyle(link).backgroundImage.replace(/^url\(('|")?(.+?)(?::small)?(?:\?.*)?\1\)$/, "$2"); + + var linkStyle = getComputedStyle(link); + + if (linkStyle == null) { + return; + } + + url = linkStyle.backgroundImage.replace(/^url\(('|")?(.+?)(?::small)?(?:\?.*)?\1\)$/, "$2"); } else { url = image.src.replace(/:[a-z0-9]+(?:\?.*)?$/, ""); }