diff --git a/__tests__/Constants.test.js b/__tests__/Constants.test.js index 944948cb..0dc95c7a 100644 --- a/__tests__/Constants.test.js +++ b/__tests__/Constants.test.js @@ -1,6 +1,5 @@ import { GET_LOCAL_STORAGE, - HOST_PBS_TWIMG_COM, HOST_PRO_TWITTER_COM, HOST_TWEETDECK_TWITTER_COM, HOST_TWITTER_COM, @@ -11,9 +10,7 @@ import { SHOW_ON_TWEETDECK_TIMELINE, SHOW_ON_TWEETDECK_TWEET_DETAIL, SHOW_ON_TWEET_DETAIL, - STRIP_IMAGE_SUFFIX, initialOptionsBool, - isImageTab, isNativeChromeExtension, isReactView, isTweetdeck, @@ -39,18 +36,12 @@ describe('定数', () => { expect(SHOW_ON_TWEETDECK_TWEET_DETAIL).toBe('SHOW_ON_TWEETDECK_TWEET_DETAIL'); }); - it('画像ページ', () => { - expect(HOST_PBS_TWIMG_COM).toBe('pbs.twimg.com'); - expect(STRIP_IMAGE_SUFFIX).toBe('STRIP_IMAGE_SUFFIX'); - }); - it('初期設定', () => { expect(initialOptionsBool).toStrictEqual({ SHOW_ON_TIMELINE: true, SHOW_ON_TWEET_DETAIL: true, SHOW_ON_TWEETDECK_TIMELINE: true, SHOW_ON_TWEETDECK_TWEET_DETAIL: true, - STRIP_IMAGE_SUFFIX: true, }); }); @@ -60,17 +51,13 @@ describe('定数', () => { SHOW_ON_TWEET_DETAIL, SHOW_ON_TWEETDECK_TIMELINE, SHOW_ON_TWEETDECK_TWEET_DETAIL, - STRIP_IMAGE_SUFFIX, ]); expect(OPTIONS_TEXT).toStrictEqual({ SHOW_ON_TIMELINE: 'タイムライン', SHOW_ON_TWEET_DETAIL: '(旧表示で)ツイート詳細', - // TweetDeck SHOW_ON_TWEETDECK_TIMELINE: 'タイムライン', SHOW_ON_TWEETDECK_TWEET_DETAIL: '(旧表示で)ツイート詳細', - // 画像ページ - STRIP_IMAGE_SUFFIX: '[Ctrl]+[s]で拡張子を校正', }); }); @@ -87,27 +74,23 @@ describe('定数', () => { window.location = new URL('https://twitter.com'); expect(isTwitter()).toBeTruthy(); expect(isTweetdeck()).toBeFalsy(); - expect(isImageTab()).toBeFalsy(); }); describe('TweetDeck', () => { it('tweetdeck.twitter.com', () => { window.location = new URL('https://tweetdeck.twitter.com'); expect(isTwitter()).toBeFalsy(); expect(isTweetdeck()).toBeTruthy(); - expect(isImageTab()).toBeFalsy(); }); it('pro.twitter.com', () => { window.location = new URL('https://pro.twitter.com'); expect(isTwitter()).toBeFalsy(); expect(isTweetdeck()).toBeTruthy(); - expect(isImageTab()).toBeFalsy(); }); }); it('画像ページ', () => { window.location = new URL('https://pbs.twimg.com'); expect(isTwitter()).toBeFalsy(); expect(isTweetdeck()).toBeFalsy(); - expect(isImageTab()).toBeTruthy(); }); }); diff --git a/__tests__/__snapshots__/popup.test.js.snap b/__tests__/__snapshots__/popup.test.js.snap index 5c2ea562..2c8651dc 100644 --- a/__tests__/__snapshots__/popup.test.js.snap +++ b/__tests__/__snapshots__/popup.test.js.snap @@ -5,7 +5,7 @@ exports[`Popup render 1`] = ` className="p-3 flex flex-col justify-center items-center" style={ { - "minWidth": "230px", + "minWidth": "260px", } } > diff --git a/src/constants.ts b/src/constants.ts index 2eeca3d4..a12bea89 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -12,9 +12,6 @@ export const HOST_TWEETDECK_TWITTER_COM = 'tweetdeck.twitter.com'; export const HOST_PRO_TWITTER_COM = 'pro.twitter.com'; export const SHOW_ON_TWEETDECK_TIMELINE = 'SHOW_ON_TWEETDECK_TIMELINE'; export const SHOW_ON_TWEETDECK_TWEET_DETAIL = 'SHOW_ON_TWEETDECK_TWEET_DETAIL'; -// 画像ページ -export const HOST_PBS_TWIMG_COM = 'pbs.twimg.com'; -export const STRIP_IMAGE_SUFFIX = 'STRIP_IMAGE_SUFFIX'; /** * 設定項目 @@ -26,8 +23,6 @@ export interface OptionsBool { // TweetDeck SHOW_ON_TWEETDECK_TIMELINE: boolean; SHOW_ON_TWEETDECK_TWEET_DETAIL: boolean; - // 画像ページ - STRIP_IMAGE_SUFFIX: boolean; } export const initialOptionsBool: OptionsBool = { @@ -37,8 +32,6 @@ export const initialOptionsBool: OptionsBool = { // TweetDeck SHOW_ON_TWEETDECK_TIMELINE: true, SHOW_ON_TWEETDECK_TWEET_DETAIL: true, - // 画像ページ - STRIP_IMAGE_SUFFIX: true, }; export const OPTION_KEYS = [ @@ -46,7 +39,6 @@ export const OPTION_KEYS = [ SHOW_ON_TWEET_DETAIL, SHOW_ON_TWEETDECK_TIMELINE, SHOW_ON_TWEETDECK_TWEET_DETAIL, - STRIP_IMAGE_SUFFIX, ] as const; export const OPTIONS_TEXT: { [key in keyof OptionsBool]: string } = { // 公式Web @@ -55,8 +47,6 @@ export const OPTIONS_TEXT: { [key in keyof OptionsBool]: string } = { // TweetDeck SHOW_ON_TWEETDECK_TIMELINE: 'タイムライン', SHOW_ON_TWEETDECK_TWEET_DETAIL: '(旧表示で)ツイート詳細', - // 画像ページ - STRIP_IMAGE_SUFFIX: '[Ctrl]+[s]で拡張子を校正', }; /** 公式Webかどうか */ @@ -65,8 +55,6 @@ export const isTwitter = (): boolean => /** Tweetdeckかどうか */ export const isTweetdeck = (): boolean => window.location.hostname === HOST_TWEETDECK_TWITTER_COM || window.location.hostname === HOST_PRO_TWITTER_COM; -/** 画像ページかどうか */ -export const isImageTab = (): boolean => window.location.hostname === HOST_PBS_TWIMG_COM; /** Reactビューかどうか */ export const isReactView = (): boolean => !!document.getElementById('react-root'); diff --git a/src/extension-contexts/popup.tsx b/src/extension-contexts/popup.tsx index bfebda47..d160c1d3 100644 --- a/src/extension-contexts/popup.tsx +++ b/src/extension-contexts/popup.tsx @@ -2,7 +2,6 @@ import React, { useCallback, useState } from 'react'; import ReactDOM from 'react-dom'; import { HOST_MOBILE_TWITTER_COM, - HOST_PBS_TWIMG_COM, HOST_TWEETDECK_TWITTER_COM, HOST_TWITTER_COM, OPTIONS_TEXT, @@ -46,11 +45,7 @@ export const Popup = (props: Props): JSX.Element => { return; } const tabUrl = new URL(tab.url).hostname; - if ( - ![HOST_TWITTER_COM, HOST_MOBILE_TWITTER_COM, HOST_TWEETDECK_TWITTER_COM, HOST_PBS_TWIMG_COM].some( - (url) => url === tabUrl, - ) - ) { + if (![HOST_TWITTER_COM, HOST_MOBILE_TWITTER_COM, HOST_TWEETDECK_TWITTER_COM].some((url) => url === tabUrl)) { // 送り先タブが拡張機能が動作する対象ではないならメッセージを送らない return; } @@ -91,7 +86,7 @@ export const Popup = (props: Props): JSX.Element => {