From 6d4a55aed6d0592a3096604c2376c8155f2a6314 Mon Sep 17 00:00:00 2001 From: Masaki Kobayashi Date: Sat, 18 Apr 2026 16:18:09 +0900 Subject: [PATCH] Remove scripts no longer used and maintained --- README.md | 8 -- dist/moneytree-shortcuts.user.js | 38 ------ dist/twitter-shortcuts.user.js | 102 ---------------- .../moneytree-shortcuts/index.user.ts | 33 ------ .../twitter-shortcuts/index.user.ts | 111 ------------------ 5 files changed, 292 deletions(-) delete mode 100644 dist/moneytree-shortcuts.user.js delete mode 100644 dist/twitter-shortcuts.user.js delete mode 100644 src/userscripts/moneytree-shortcuts/index.user.ts delete mode 100644 src/userscripts/twitter-shortcuts/index.user.ts diff --git a/README.md b/README.md index a0061bee..a86cc1c1 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,6 @@ Space key to like, arrow/h/l keys to next/previous photo in the post Redirect Japanese pages in MDN to corresponding English pages -### [Moneytree shortcut keys](https://github.com/mkobayashime/userscripts/raw/main/dist/moneytree-shortcuts.user.js) - -Moneytree にショートカットキーを追加します - ### [Pinterest - Shortcuts in "Save from site"](https://github.com/mkobayashime/userscripts/raw/main/dist/pinterest-save-from-site-shortcuts.user.js) Ctrl+Enter in "Save from site" @@ -98,10 +94,6 @@ Disable autofocus to the message input field after moved to another channel Alert when you reload/close Slack with a new draft -### [Twitter - Shortcuts](https://github.com/mkobayashime/userscripts/raw/main/dist/twitter-shortcuts.user.js) - -Refined shortcuts in Twitter for web - ### [Zoom - Shortcuts](https://github.com/mkobayashime/userscripts/raw/main/dist/zoom-web-shortcuts.user.js) Google Meet-like Ctrl-d/e shortcuts in Zoom diff --git a/dist/moneytree-shortcuts.user.js b/dist/moneytree-shortcuts.user.js deleted file mode 100644 index 3d70fbd0..00000000 --- a/dist/moneytree-shortcuts.user.js +++ /dev/null @@ -1,38 +0,0 @@ -// ==UserScript== -// @name Moneytree shortcut keys -// @namespace mkobayashime -// @version 1.3.3 -// @description Moneytree にショートカットキーを追加します -// @icon https://www.google.com/s2/favicons?domain=getmoneytree.com -// @author mkobayashime -// @homepage https://github.com/mkobayashime/userscripts -// @homepageURL https://github.com/mkobayashime/userscripts -// @match https://app.getmoneytree.com/* -// @run-at document-end -// @updateURL https://github.com/mkobayashime/userscripts/raw/main/dist/moneytree-shortcuts.user.js -// @downloadURL https://github.com/mkobayashime/userscripts/raw/main/dist/moneytree-shortcuts.user.js -// ==/UserScript== - -// src/userscripts/moneytree-shortcuts/index.user.ts -void (() => { - document.onkeypress = (e) => { - if (e.ctrlKey && e.code === "Enter") { - const saveBtnInner = document.getElementsByClassName( - "modal-header-done-text", - )[0]; - if (saveBtnInner) { - saveBtnInner.parentElement?.click(); - } - } - }; - document.onkeyup = (e) => { - if (e.key === "Escape") { - const cancelBtnInner = document.getElementsByClassName( - "modal-header-back-text", - )[0]; - if (cancelBtnInner) { - cancelBtnInner.parentElement?.click(); - } - } - }; -})(); diff --git a/dist/twitter-shortcuts.user.js b/dist/twitter-shortcuts.user.js deleted file mode 100644 index 47b4ce4f..00000000 --- a/dist/twitter-shortcuts.user.js +++ /dev/null @@ -1,102 +0,0 @@ -// ==UserScript== -// @name Twitter - Shortcuts -// @namespace mkobayashime -// @version 0.4.3 -// @description Refined shortcuts in Twitter for web -// @icon https://www.google.com/s2/favicons?domain=twitter.com -// @author mkobayashime -// @homepage https://github.com/mkobayashime/userscripts -// @homepageURL https://github.com/mkobayashime/userscripts -// @match https://twitter.com/* -// @updateURL https://github.com/mkobayashime/userscripts/raw/main/dist/twitter-shortcuts.user.js -// @downloadURL https://github.com/mkobayashime/userscripts/raw/main/dist/twitter-shortcuts.user.js -// ==/UserScript== - -// src/userscripts/utils/isTyping.ts -var isTyping = () => { - const inputTags = ["INPUT", "TEXTAREA", "SELECT"]; - return ( - inputTags.includes(document.activeElement?.tagName.toUpperCase() ?? "") || - document.activeElement?.attributes.getNamedItem("role")?.value === "textbox" - ); -}; - -// src/userscripts/twitter-shortcuts/index.user.ts -void (() => { - const findTweetInCenter = () => { - if (/^https:\/\/twitter.com\/.*\/status\//.exec(window.location.href)) { - return document.querySelector( - "article[data-testid='tweet'][tabindex='-1']", - ); - } - const tweetWrappers = Array.from( - document.querySelectorAll("article[data-testid='tweet']"), - ); - if (tweetWrappers.length === 0) return; - if (tweetWrappers.length === 1) return tweetWrappers[0]; - return tweetWrappers.find((element) => { - const windowHalfHeight = window.innerHeight / 2; - const { top, height } = element.getBoundingClientRect(); - return top <= windowHalfHeight && top + height >= windowHalfHeight; - }); - }; - document.body.addEventListener("keypress", (e) => { - if (isTyping()) return; - if ( - // default Mute - e.key === "u" || // default Block - e.key === "x" - ) { - e.stopImmediatePropagation(); - } - }); - window.addEventListener("keydown", (e) => { - if (isTyping()) return; - if (e.key === "Escape") { - const closeButton = document.querySelector("[aria-label='Close']"); - if (closeButton) closeButton.click(); - } - if (e.key === " ") { - e.preventDefault(); - } - if (e.key === "[" || e.key === "]") { - const tabs = Array.from( - document.querySelectorAll("[role='tablist'] a[role='tab']"), - ); - const activeTabIndex = tabs.findIndex( - (element) => element.ariaSelected === "true", - ); - if (activeTabIndex < 0) return; - const indexOfTabToClick = - e.key === "[" - ? activeTabIndex === 0 - ? -1 - : activeTabIndex - 1 - : activeTabIndex === tabs.length - 1 - ? -1 - : activeTabIndex + 1; - if (indexOfTabToClick < 0) return; - if (tabs[indexOfTabToClick]) { - tabs[indexOfTabToClick].click(); - } - } - if (e.ctrlKey && e.key === "e") { - const tweetURLMatch = - /^https:\/\/twitter\.com\/\S+\/status\/\d+[^/]*/.exec( - window.location.href, - ); - if (!tweetURLMatch) return; - e.preventDefault(); - window.open(`${tweetURLMatch[0]}/likes`); - } - if (e.ctrlKey && e.key === "l") { - e.preventDefault(); - const targetTweet = findTweetInCenter(); - if (!targetTweet) return; - const likeButton = targetTweet.querySelector( - "[data-testid='like'][role='button'], [data-testid='unlike'][role='button']", - ); - if (likeButton instanceof HTMLElement) likeButton.click(); - } - }); -})(); diff --git a/src/userscripts/moneytree-shortcuts/index.user.ts b/src/userscripts/moneytree-shortcuts/index.user.ts deleted file mode 100644 index 3f332d4c..00000000 --- a/src/userscripts/moneytree-shortcuts/index.user.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineUserScript } from "bundlemonkey"; - -export default defineUserScript({ - name: "Moneytree shortcut keys", - version: "1.3.3", - description: "Moneytree にショートカットキーを追加します", - match: ["https://app.getmoneytree.com/*"], - runAt: "document-end", - icon: "https://www.google.com/s2/favicons?domain=getmoneytree.com", - main: () => { - document.onkeypress = (e) => { - if (e.ctrlKey && e.code === "Enter") { - const saveBtnInner = document.getElementsByClassName( - "modal-header-done-text", - )[0]; - if (saveBtnInner) { - saveBtnInner.parentElement?.click(); - } - } - }; - - document.onkeyup = (e) => { - if (e.key === "Escape") { - const cancelBtnInner = document.getElementsByClassName( - "modal-header-back-text", - )[0]; - if (cancelBtnInner) { - cancelBtnInner.parentElement?.click(); - } - } - }; - }, -}); diff --git a/src/userscripts/twitter-shortcuts/index.user.ts b/src/userscripts/twitter-shortcuts/index.user.ts deleted file mode 100644 index 539e8f55..00000000 --- a/src/userscripts/twitter-shortcuts/index.user.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { defineUserScript } from "bundlemonkey"; -import { isTyping } from "../utils/isTyping"; - -export default defineUserScript({ - name: "Twitter - Shortcuts", - version: "0.4.3", - description: "Refined shortcuts in Twitter for web", - match: ["https://twitter.com/*"], - icon: "https://www.google.com/s2/favicons?domain=twitter.com", - main: () => { - const findTweetInCenter = () => { - if (/^https:\/\/twitter.com\/.*\/status\//.exec(window.location.href)) { - return document.querySelector( - "article[data-testid='tweet'][tabindex='-1']", - ); - } - - const tweetWrappers = Array.from( - document.querySelectorAll("article[data-testid='tweet']"), - ); - - if (tweetWrappers.length === 0) return; - if (tweetWrappers.length === 1) return tweetWrappers[0]; - - return tweetWrappers.find((element) => { - const windowHalfHeight = window.innerHeight / 2; - const { top, height } = element.getBoundingClientRect(); - - return top <= windowHalfHeight && top + height >= windowHalfHeight; - }); - }; - - document.body.addEventListener("keypress", (e) => { - if (isTyping()) return; - - if ( - // default Mute - e.key === "u" || - // default Block - e.key === "x" - ) { - e.stopImmediatePropagation(); - } - }); - - window.addEventListener("keydown", (e) => { - if (isTyping()) return; - - if (e.key === "Escape") { - const closeButton = document.querySelector( - "[aria-label='Close']", - ); - if (closeButton) closeButton.click(); - } - - if (e.key === " ") { - e.preventDefault(); - } - - if (e.key === "[" || e.key === "]") { - const tabs = Array.from( - document.querySelectorAll( - "[role='tablist'] a[role='tab']", - ), - ); - - const activeTabIndex = tabs.findIndex( - (element) => element.ariaSelected === "true", - ); - if (activeTabIndex < 0) return; - - const indexOfTabToClick = - e.key === "[" - ? activeTabIndex === 0 - ? -1 - : activeTabIndex - 1 - : activeTabIndex === tabs.length - 1 - ? -1 - : activeTabIndex + 1; - if (indexOfTabToClick < 0) return; - - if (tabs[indexOfTabToClick]) { - tabs[indexOfTabToClick].click(); - } - } - - if (e.ctrlKey && e.key === "e") { - const tweetURLMatch = - /^https:\/\/twitter\.com\/\S+\/status\/\d+[^/]*/.exec( - window.location.href, - ); - if (!tweetURLMatch) return; - - e.preventDefault(); - window.open(`${tweetURLMatch[0]}/likes`); - } - - if (e.ctrlKey && e.key === "l") { - e.preventDefault(); - - const targetTweet = findTweetInCenter(); - if (!targetTweet) return; - - const likeButton = targetTweet.querySelector( - "[data-testid='like'][role='button'], [data-testid='unlike'][role='button']", - ); - if (likeButton instanceof HTMLElement) likeButton.click(); - } - }); - }, -});