Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"message": "Install latest version from GitHub",
"description": "ポップアップのボタンのツールチップ"
},
"popupButton7": {
"message": "Rescue the settings in twitter.com that are lost by change domain to x.com",
"description": "ポップアップのボタンのツールチップ"
},
"pSettings": {
"message": "Settings",
"description": "ポップアップの設定ボタン"
Expand All @@ -81,10 +77,6 @@
"message": "Install the latest version",
"description": "ポップアップのGitHubから最新版をインストールするボタン"
},
"pPrintTUICPref": {
"message": "Rescuing twitter.com's TUIC settings",
"description": "ポップアップのtwitter.comでの設定を救出するボタン"
},
"pUpdateOnBrowserLaunch": {
"message": "When the browser is launched",
"description": "ポップアップのアップデート通知設定"
Expand Down
8 changes: 0 additions & 8 deletions _locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@
"message": "最新版をGitHubからインストール",
"description": "ポップアップのボタンのツールチップ"
},
"popupButton7": {
"message": "ドメイン変更によって失われてしまったtwitter.comでの設定を救出",
"description": "ポップアップのボタンのツールチップ"
},
"pSettings": {
"message": "設定",
"description": "ポップアップの設定ボタン"
Expand All @@ -82,10 +78,6 @@
"message": "最新版をインストール",
"description": "ポップアップのGitHubから最新版をインストールするボタン"
},
"pPrintTUICPref": {
"message": "twitter.comでの設定を救出",
"description": "ポップアップのtwitter.comでの設定を救出するボタン"
},
"pUpdateOnBrowserLaunch": {
"message": "ブラウザを起動したとき",
"description": "ポップアップのアップデート通知設定"
Expand Down
8 changes: 0 additions & 8 deletions _locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"message": "최신 버전을 GitHub에서 설치",
"description": "ポップアップのボタンのツールチップ"
},
"popupButton7": {
"message": "도메인 변경으로 소실된 twitter.com에서의 설정 구출",
"description": "ポップアップのボタンのツールチップ"
},
"pSettings": {
"message": "설정",
"description": "ポップアップの設定ボタン"
Expand All @@ -81,10 +77,6 @@
"message": "최신 버전을 설치",
"description": "ポップアップのGitHubから最新版をインストールするボタン"
},
"pPrintTUICPref": {
"message": "twitter.com에서의 설정을 구출",
"description": "ポップアップのtwitter.comでの設定を救出するボタン"
},
"pUpdateOnBrowserLaunch": {
"message": "브라우저를 켰을때",
"description": "ポップアップのアップデート通知設定"
Expand Down
4 changes: 0 additions & 4 deletions _locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"message": "Установите последнюю версию с GitHub",
"description": "ポップアップのボタンのツールチップ"
},
"popupButton7": {
"message": "Извлечь настройки из twitter.com, которые были утеряны из-за изменения домена.",
"description": "ポップアップのボタンのツールチップ"
},
"pSettings": {
"message": "Настройки",
"description": "ポップアップの設定ボタン"
Expand Down
8 changes: 0 additions & 8 deletions _locales/zh-CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"message": "从 Github 安装最新版本",
"description": "ポップアップのボタンのツールチップ"
},
"popupButton7": {
"message": "抢救因域名变更而丢失的twitter.com设置",
"description": "ポップアップのボタンのツールチップ"
},
"pSettings": {
"message": "设置",
"description": "ポップアップの設定ボタン"
Expand All @@ -81,10 +77,6 @@
"message": "安装最新版本",
"description": "ポップアップのGitHubから最新版をインストールするボタン"
},
"pPrintTUICPref": {
"message": "抢救你的Twitter.com设置",
"description": "ポップアップのtwitter.comでの設定を救出するボタン"
},
"pUpdateOnBrowserLaunch": {
"message": "启动浏览器时",
"description": "ポップアップのアップデート通知設定"
Expand Down
7 changes: 0 additions & 7 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,7 @@
"common-hide": "Hide",
"common-displaySetting": "Display Settings",
"common-copy-and-close": "Copy and Close",
"common-copy-and-go": "Copy and Next",
"common-copy": "Copy",
"common-cancel": "Cancel",
"common-go-and-openNewTab": "Proceed (opens external page)",
"rescuePref-ButtonLabel": "Rescuing twitter.com's TUIC settings",
"rescuePref-dialog": "To recover your settings, access the Twitter homepage on twitter.com, which is still available. \nOnce twitter.com is open, navigate to the TUIC display settings and click on 'Export/Import' at the bottom of the page to export your settings. \nThis will open a new tab with an external page. \nAfter completing this step, return to the original tab, where you will see the settings import screen.",
"rescuePref-detail": "You will see the exported settings and CSS. Copy each of them and import/save them in x.com.",
"rescuePref-complete": "The rescue is now complete. Please load each one in TUIC at x.com. Sorry, custom icons are not supported.",
"inportExportOptions.includingCustomCSS": "Include Custom CSS in the export contents",
"temp-notice-hideDMSheetOnBottomRight": "Currently, the DMs card in the lower right corner can be hidden from \"Misc Settings\"."
}
8 changes: 0 additions & 8 deletions i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,7 @@
"common-hide": "非表示にする",
"common-displaySetting": "表示設定",
"common-copy-and-close": "コピーして閉じる",
"common-copy-and-go": "コピーして進む",
"common-copy": "コピー",
"common-cancel": "キャンセル",
"common-go-and-openNewTab": "進む (外部ページを開きます)",

"rescuePref-ButtonLabel": "twitter.comのTUICの設定を救出する",
"rescuePref-dialog": "まだ利用できるtwitter.comのホームページを利用して救出します。\ntwitter.comが開くので、TUICの表示設定に進み、下の方にある「エクスポート/インポート」から設定をエクスポートしてください。\nボタンを押すと外部ページを新しいタブで開きます。\nこのタブに戻ると設定のインポート画面が表示されます",
"rescuePref-detail": "エクスポートされた設定、CSSの順で表示されます。それぞれコピーしてx.comでインポート/保存してください。",
"rescuePref-complete": "これで救出完了です。それぞれx.comのTUICで読み込んでください。カスタムアイコンに関しては、申し訳ございませんが対応しておりません。",

"inportExportOptions.includingCustomCSS": "エクスポート内容にカスタムCSSを含める",

Expand Down
7 changes: 0 additions & 7 deletions i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,7 @@
"common-hide": "숨기기",
"common-displaySetting": "표시 설정",
"common-copy-and-close": "복사 및 닫기",
"common-copy-and-go": "복사하고 다음",
"common-copy": "복사",
"common-cancel": "취소",
"common-go-and-openNewTab": "다음 (외부 페이지를 열어요)",
"rescuePref-ButtonLabel": "twitter.com의 TUIC 설정을 구출하기",
"rescuePref-dialog": "아직 사용할 수 있는 twitter.com의 홈페이지를 이용하여 구출합니다.\ntwitter.com가 열리므로, TUIC의 표시 설정에 가서, 아래 쪽에 있는 \"내보내기/가져오기\"로부터 설정을 내보내 주세요.\n이 탭에 돌아오면 설정의 가져오기 화면이 표시됩니다.",
"rescuePref-detail": "내보낸 설정, CSS의 순서로 표시됩니다. 복사하여 x.com에서 각각 가져오기, 저장해 주세요.",
"rescuePref-complete": "구출 완료이에요! 각각 x.com의 TUIC에서 가져오기 해 주세요. 커스텀 아이콘에 대해서는 죄송합니다만 지원하지 않아요.",
"inportExportOptions.includingCustomCSS": "출력 내용에 커스텀 CSS를 포함하기",
"temp-notice-hideDMSheetOnBottomRight": "현재 화면 오른쪽 아래에 존재하는 DM 항목은 \"그 외 설정\"에서 숨길 수 있어요."
}
7 changes: 0 additions & 7 deletions i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,7 @@
"common-hide": "隐藏",
"common-displaySetting": "推文显示设置",
"common-copy-and-close": "复制并关闭",
"common-copy-and-go": "复制并继续",
"common-copy": "复制",
"common-cancel": "取消",
"common-go-and-openNewTab": "继续(将打开外部页面)",
"rescuePref-ButtonLabel": "抢救twitter.com的TUIC设置",
"rescuePref-dialog": "将利用仍可访问的twitter.com主页进行设置抢救。\ntwitter.com页面打开后,请进入TUIC显示设置,在底部找到「导出/导入」功能并导出设置。\n点击按钮将在新标签页打开外部页面。\n返回本标签页时将显示设置导入界面。",
"rescuePref-detail": "导出的设置将按CSS顺序显示,请分别复制后前往x.com进行导入/保存操作。",
"rescuePref-complete": "至此已完成设置抢救,请前往x.com的TUIC界面分别加载各项配置。关于自定义图标功能,我们深表歉意,目前暂不支持该项目的恢复。",
"inportExportOptions.includingCustomCSS": "将自定义CSS包含在导出内容中",
"temp-notice-hideDMSheetOnBottomRight": "当前位于画面右下角的私信DM栏目,可通过「其他设置」选项隐藏。"
}
136 changes: 59 additions & 77 deletions src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,99 +11,81 @@ import { startTluiObserver } from "@shared/tlui/observer";
import { changeLoadingLogo } from "@content/functions/changeIcon";
import { setTitleObserver } from "@content/functions/replaceTitleX";
import { runSettingComponentObserver } from "@content/settings/ui";
import { placePrintPrefButton } from "./printPref";
import { getPref, mergeDefaultPref, setPref, updatePref } from "@content/settings";
import { waitForElement } from "@content/utils/element";

(async () => {
// TODO: twitter.com は x.com に強制的にリダイレクトされるため、これらは使用不可能
if (location.href === "https://twitter.com/ja/tos") {
injectSystemStyle();
await Promise.all([
// NOTE: i18n データのフェッチ
await loadI18n();
// Pref救出
placePrintPrefButton();
} else if (location.href === "https://twitter.com//") {
// NOTE: i18n データのフェッチ
await loadI18n();
//document.write("aaa");
alert(translate("rescuePref-detail", "ja") + "\n\n" + translate("rescuePref-detail", "en"));
alert(localStorage.getItem("TUIC"));
alert(localStorage.getItem("TUIC_CSS"));
alert(translate("rescuePref-complete", "ja") + "\n\n" + translate("rescuePref-complete", "en"));
} else {
await Promise.all([
// NOTE: i18n データのフェッチ
loadI18n(),
// NOTE: 設定の更新
updatePref(),

// NOTE: Twitter のレンダリングを待機
waitForElement("#react-root"),
]);

setPref("", mergeDefaultPref(getPref("")));
loadI18n(),
// NOTE: 設定の更新
updatePref(),

// 起動メッセージ
console.log(
`%cTwitter UI Customizer${isSafemode ? " (Safe Mode)" : ""}%cby kaonasi_biwa\n\nTwitter を思いのままに。⧸ Language: ${translate("@JapaneseLanguageName")}`,
`font-family: system-ui, -apple-system, sans-serif, monospace; font-size: 1.2em; font-weight: bold; text-align: center; background: ${isSafemode ? "#5a9e1b" : "#1da1f2"}; color: #ffffff; padding: 0.5em 2em; margin-top: 0.5em; margin-left: 0.5em;`,
`font-family: system-ui, -apple-system, sans-serif, monospace; margin: 0.5em; color: ${isSafemode ? "#5a9e1b" : "#1da1f2"};`,
);
// NOTE: Twitter のレンダリングを待機
waitForElement("#react-root"),
]);

if (getPref("XToTwitter.PwaManifest")) {
chrome.runtime.sendMessage({
type: "enableReplaceTwitterManifest",
lang: document.documentElement.getAttribute("lang"),
});
} else {
chrome.runtime.sendMessage({
type: "disableReplaceTwitterManifest",
});
}
setPref("", mergeDefaultPref(getPref("")));

// 前起動時のTUICの要素・Classが残っていればすべて削除
cleanModifiedElements();
for (const elem of document.querySelectorAll(".TUICOriginalContent")) {
elem.remove();
}
// 起動メッセージ
console.log(
`%cTwitter UI Customizer${isSafemode ? " (Safe Mode)" : ""}%cby kaonasi_biwa\n\nTwitter を思いのままに。⧸ Language: ${translate("@JapaneseLanguageName")}`,
`font-family: system-ui, -apple-system, sans-serif, monospace; font-size: 1.2em; font-weight: bold; text-align: center; background: ${isSafemode ? "#5a9e1b" : "#1da1f2"}; color: #ffffff; padding: 0.5em 2em; margin-top: 0.5em; margin-left: 0.5em;`,
`font-family: system-ui, -apple-system, sans-serif, monospace; margin: 0.5em; color: ${isSafemode ? "#5a9e1b" : "#1da1f2"};`,
);

// アップデート通知
if (getPref("XToTwitter.PwaManifest")) {
chrome.runtime.sendMessage({
type: "enableReplaceTwitterManifest",
lang: document.documentElement.getAttribute("lang"),
});
} else {
chrome.runtime.sendMessage({
type: "update",
updateType: "openTwitter",
type: "disableReplaceTwitterManifest",
});
}

// CSSの適用
injectSystemStyle();
injectSettingsStyle();
injectCustomStyle();
injectSystemIconStyle();
injectSettingsIconStyle();
// 前起動時のTUICの要素・Classが残っていればすべて削除
cleanModifiedElements();
for (const elem of document.querySelectorAll(".TUICOriginalContent")) {
elem.remove();
}

// 起動時のTwitterアイコンを変更
changeLoadingLogo();
// アップデート通知
chrome.runtime.sendMessage({
type: "update",
updateType: "openTwitter",
});

// タイトル変更のためのObserver
waitForElement("title").then(setTitleObserver);
// CSSの適用
injectSystemStyle();
injectSettingsStyle();
injectCustomStyle();
injectSystemIconStyle();
injectSettingsIconStyle();

// TLUI用のObserver
startTluiObserver();
// 起動時のTwitterアイコンを変更
changeLoadingLogo();

// メインのObserver
const observer = new TUICObserver(document.body);
observer.bind();
observer.callback();
runSettingComponentObserver();
// タイトル変更のためのObserver
waitForElement("title").then(setTitleObserver);

// フォントサイズ変更の検出のためのObserver
new MutationObserver(injectSettingsStyle).observe(document.body, {
childList: false,
subtree: false,
attributes: true,
});
// TLUI用のObserver
startTluiObserver();

// セーフモード
if (isSafemode) runSafemode();
}
// メインのObserver
const observer = new TUICObserver(document.body);
observer.bind();
observer.callback();
runSettingComponentObserver();

// フォントサイズ変更の検出のためのObserver
new MutationObserver(injectSettingsStyle).observe(document.body, {
childList: false,
subtree: false,
attributes: true,
});

// セーフモード
if (isSafemode) runSafemode();
})();
63 changes: 0 additions & 63 deletions src/content/printPref.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions src/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ <h1 class="thankyou i18n" i18n-id="popupContent1">使ってくれてありがと
<div class="bi bi-github"></div>
<div class="i18n-t i18n" i18n-t-id="popupButton5" i18n-id="pInstallFromGH">最新版をインストール</div>
</a>
<a href="#" id="link7">
<div class="bi bi-tuic"></div>
<div class="i18n-t i18n" i18n-t-id="popupButton7" i18n-id="pPrintTUICPref">twitter.comでの設定を救出</div>
</a>
</div>
<hr class="divider" />
<details>
Expand Down
Loading
Loading