changeset 67:f03e2d169a8a

Only delete format if there's extension in filename
author nanaya <me@nanaya.pro>
date Thu, 11 Jul 2019 07:37:18 +0900
parents 444b17e657be
children 7784a39c891b
files tweetdeck-large-image.user.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tweetdeck-large-image.user.js	Wed Jul 10 22:36:31 2019 +0900
+++ b/tweetdeck-large-image.user.js	Thu Jul 11 07:37:18 2019 +0900
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name         Tweetdeck large image
 // @namespace    https://myconan.net
-// @version      2.0.5.1
+// @version      2.0.6
 // @description  No more stupid link for images in tweetdeck
 // @author       nanaya
 // @match        https://tweetdeck.twitter.com/*
@@ -59,7 +59,9 @@
     if (parsedUrl.searchParams.get('name') == null) {
       url = url.replace(/(\..+:).+/, '$1orig')
     } else {
-      parsedUrl.searchParams.delete('format')
+      if (parsedUrl.pathname.match(/\.[^.]+$/) !== null) {
+        parsedUrl.searchParams.delete('format')
+      }
       parsedUrl.searchParams.set('name', 'orig')
       url = parsedUrl.href
     }