Skip to content

Instantly share code, notes, and snippets.

@s2terminal
Created December 30, 2025 12:29
Show Gist options
  • Select an option

  • Save s2terminal/56861abc0ab12eab2d3dd2588ce7dfca to your computer and use it in GitHub Desktop.

Select an option

Save s2terminal/56861abc0ab12eab2d3dd2588ce7dfca to your computer and use it in GitHub Desktop.
TampermonkeyでTwitterのレイアウトを調整するスクリプト
// ==UserScript==
// @name Twitter
// @namespace http://tampermonkey.net/
// @version 2025-12-23
// @description Simplify Twitter
// @author s2terminal
// @match https://x.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
// 画面の変化を監視して実行する関数
const observer = new MutationObserver((mutations) => {
process();
});
// 監視を開始(body以下の全要素の変化を見る)
observer.observe(document.body, {
childList: true,
subtree: true
});
// 具体的な処理を行う関数
function process() {
// 不要なナビゲーションを消す
document.querySelectorAll('a[href="/notifications"]').forEach(e => e.remove());
document.querySelectorAll('a[href="/i/chat"]').forEach(e => e.remove());
document.querySelectorAll('a[href="/i/grok"]').forEach(e => e.remove());
document.querySelectorAll('[aria-label*="Grok"]').forEach(e => e.remove());
// サイドバーをすべて消す
document.querySelector("header div div")?.remove();
const columns = document.querySelector("main > div > div > div");
if (columns && columns?.children?.length > 1) {
columns.lastChild.remove();
}
document.querySelector('div[style="z-index: 1;"]')?.remove();
console.log("削除した");
}
document.addEventListener("DOMContentLoaded", (event) => {
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment