Skip to content

Instantly share code, notes, and snippets.

@Taremin
Created December 16, 2025 06:26
Show Gist options
  • Select an option

  • Save Taremin/22b5101f2e9749239e28a80a6a35cd6e to your computer and use it in GitHub Desktop.

Select an option

Save Taremin/22b5101f2e9749239e28a80a6a35cd6e to your computer and use it in GitHub Desktop.
Twitterで素早くフォロー中に切り替えるUserScript
// ==UserScript==
// @name Twitter
// @namespace http://tampermonkey.net/
// @version 2025-12-16
// @description ページ読み込み後「フォロー中」をクリックする
// @author Taremin
// @match https://x.com/home
// @grant none
// ==/UserScript==
(function() {
'use strict';
const observer = new MutationObserver((mutationList, observer) => {
for (const mutation of mutationList) {
if (mutation.type === "childList") {
const targets = Array.prototype.concat(mutation.addedNodes, [mutation.target])
for (const target of targets) {
const tabs = document.querySelectorAll('[role="tab"]');
for (const tab of tabs) {
if (/フォロー中/.test(tab.innerHTML)) {
tab.click();
observer.disconnect();
}
}
}
}
}
});
observer.observe(document.body, { attributes: false, childList: true, subtree: true });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment