diff tweetdeck-large-image.user.js @ 60:cd3ffdc31613

Better null check
author nanaya <me@nanaya.pro>
date Sun, 05 May 2019 22:36:10 +0900
parents 960d452dea99
children 753765f3814e
line wrap: on
line diff
--- a/tweetdeck-large-image.user.js	Thu Aug 23 22:58:33 2018 +0900
+++ b/tweetdeck-large-image.user.js	Sun May 05 22:36:10 2019 +0900
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name         Tweetdeck large image
 // @namespace    https://myconan.net
-// @version      2.0.1
+// @version      2.0.2
 // @description  No more stupid link for images in tweetdeck
 // @author       nanaya
 // @match        https://tweetdeck.twitter.com/*
@@ -14,7 +14,7 @@
 
   // loop through passed nodes (or body if called without arguments)
   var run = function(nodes) {
-    if (nodes === undefined) {
+    if (nodes == null) {
       nodes = [document.body];
     }
 
@@ -46,7 +46,7 @@
     var image = link.querySelector(".media-img");
     var url;
 
-    if (image === null) {
+    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");