X(旧Twitter)で特定の人のホームを見るとき、本人のポストだけでなく、リポストも含めて時系列で見たい。
現在(2026年8月)のXでは、プロフィールの投稿一覧に「ポスト」と「すべて」があり、「すべて」を選ぶとリポストも含めて表示できます。
個人的にはリポストも含めて時系列で見たいことがほとんどなので毎回「すべて」を選択するのが少し面倒でした。
そこで、ブラウザでプロフィールを開いたら自動的に「すべて」の状態にするTampermonkeyスクリプトを書きました。
どんなスクリプト?
ブラウザ上で誰かのプロフィールを開くと、
https://x.com/ユーザー名
↓
https://x.com/ユーザー名/all
となり、最初から「すべて」が表示されます。
ただし、ここから自分で「ポスト」を選択した場合は、そのまま「ポスト」が表示されます。(ポストだけを見たいこともある)
また、別のプロフィールへ移動すれば、そちらも自動的に「すべて」に切り替わります。
- プロフィールを開く →「すべて」
- 自分で「ポスト」を選ぶ →「ポスト」のまま
- 別のプロフィールへ移動 →「すべて」
という動作です。
使い方
TampermonkeyなどのUserScriptの使用できるブラウザ拡張機能で、新しいユーザースクリプトを作成し、以下のコードをそのまま貼り付けて保存してください。
// ==UserScript==
// @name X プロフィールを常に「すべて」で表示
// @namespace https://iaoekaki.blogspot.com/
// @version 1.2.0
// @description Xのプロフィールを開いたときは「すべて」を表示。ただし自分で「ポスト」を選んだ場合は維持する
// @author iao
// @match https://x.com/*
// @match https://twitter.com/*
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
'use strict';
/*
* Xのシステム用パス
*/
const RESERVED = new Set([
'home',
'explore',
'notifications',
'messages',
'settings',
'search',
'compose',
'i',
'intent',
'login',
'logout',
'signup',
'tos',
'privacy',
'account',
'hashtag',
'jobs',
'lists',
'communities',
'bookmarks',
'premium',
'verified'
]);
/*
* 現在のプロフィールユーザー。
*
* 「同じプロフィール内で /all → /username」
* になった場合は、手動で「ポスト」を選んだと判断する。
*/
let currentProfile = null;
/*
* 最後に確認したURL
*/
let lastPath = '';
/*
* /username
*/
function getProfileUsername(pathname) {
// 先頭・末尾の / を除去
const path = pathname.replace(/^\/+|\/+$/g, '');
// usernameだけならプロフィールのトップ
if (!path || path.includes('/')) {
return null;
}
// Xのシステム用URLを除外
if (RESERVED.has(path.toLowerCase())) {
return null;
}
return path;
}
/*
* /username/all
*/
function getAllProfileUsername(pathname) {
const match = pathname.match(/^\/([^/]+)\/all\/?$/);
if (!match) {
return null;
}
if (RESERVED.has(match[1].toLowerCase())) {
return null;
}
return match[1];
}
/*
* 現在のプロフィールURLを /username の形で取得
*/
function getProfileFromPath(pathname) {
return (
getProfileUsername(pathname) ||
getAllProfileUsername(pathname)
);
}
/*
* /username → /username/all
*/
function redirectToAll(username) {
const pathname = window.location.pathname;
const newPath =
'/' +
username.replace(/^\/+|\/+$/g, '') +
'/all';
if (pathname === newPath) {
return;
}
// XはSPAなので location.href ではなく history.replaceState() を使用。
history.replaceState(
history.state,
'',
newPath +
window.location.search +
window.location.hash
);
// X側にページ遷移を認識させるため、popstate発火
window.dispatchEvent(
new PopStateEvent('popstate')
);
}
/*
* URLが変化したときの処理
*/
function handleNavigation() {
const pathname = window.location.pathname;
if (pathname === lastPath) {
return;
}
const previousPath = lastPath;
lastPath = pathname;
const username = getProfileUsername(pathname);
const allUsername = getAllProfileUsername(pathname);
/*
* ----------------------------------------
* /username/all
* ----------------------------------------
*/
if (allUsername) {
currentProfile = allUsername.toLowerCase();
return;
}
/*
* ----------------------------------------
* /username
* ----------------------------------------
*/
if (username) {
const normalizedUsername = username.toLowerCase();
/*
* 同じプロフィールで
*
* /username/all
* ↓
* /username
*
* になった場合。
*
* これはユーザーが「ポスト」を選択した
* と判断し、そのままにする。
*/
if (
currentProfile === normalizedUsername &&
getAllProfileUsername(previousPath)
) {
return;
}
/*
* 別のプロフィールを開いた場合。
*
* /AAA/all
* ↓
* /BBB
*
* のようなケース。
*
* 新しいプロフィールなので「すべて」にする。
*/
currentProfile = normalizedUsername;
redirectToAll(username);
return;
}
/*
* プロフィール以外へ移動した場合。
*/
currentProfile = null;
}
/*
* ----------------------------------------
* XのSPAナビゲーションを監視
* ----------------------------------------
*/
const originalPushState = history.pushState;
const originalReplaceState = history.replaceState;
history.pushState = function () {
const result =
originalPushState.apply(this, arguments);
setTimeout(handleNavigation, 0);
return result;
};
history.replaceState = function () {
const result =
originalReplaceState.apply(this, arguments);
setTimeout(handleNavigation, 0);
return result;
};
/*
* 戻る・進む
*/
window.addEventListener('popstate', () => {
setTimeout(handleNavigation, 0);
});
/*
* 念のためURLを定期確認。
*
* Xがhistory API以外の方法でURLを変更する場合への保険。
*/
setInterval(() => {
if (window.location.pathname !== lastPath) {
handleNavigation();
}
}, 300);
/*
* 初回
*/
handleNavigation();
})();
毎回「すべて」をクリックするのが面倒だったので、これでかなり快適になりました。

