From c5b8316a98d7bcf3fa82ab0f465107e2d8410cfa Mon Sep 17 00:00:00 2001 From: yakisova41 Date: Sun, 8 Dec 2024 18:09:29 +0900 Subject: [PATCH 1/3] Needn't prettier module path --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3a4709f..0839a94 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,4 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", "typescript.enablePromptUseWorkspaceTsdk": true, "editor.tabSize": 2, - "prettier.prettierPath": "./node_modules/prettier" } From de269127b3e440e17c236c37994d8cab97f40e21 Mon Sep 17 00:00:00 2001 From: yakisova41 Date: Sun, 8 Dec 2024 18:20:27 +0900 Subject: [PATCH 2/3] Remember button color --- extension/userscript.user.js | 47 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/extension/userscript.user.js b/extension/userscript.user.js index 3807d63..c5e6fd6 100644 --- a/extension/userscript.user.js +++ b/extension/userscript.user.js @@ -31,7 +31,7 @@ const paths = { oldHomePath: "M12 9c-2.209 0-4 1.791-4 4s1.791 4 4 4 4-1.791 4-4-1.791-4-4-4zm0 6c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2zm0-13.304L.622 8.807l1.06 1.696L3 9.679V19.5C3 20.881 4.119 22 5.5 22h13c1.381 0 2.5-1.119 2.5-2.5V9.679l1.318.824 1.06-1.696L12 1.696zM19 19.5c0 .276-.224.5-.5.5h-13c-.276 0-.5-.224-.5-.5V8.429l7-4.375 7 4.375V19.5z", oldHomeActivePath: - "M12 1.696L.622 8.807l1.06 1.696L3 9.679V19.5C3 20.881 4.119 22 5.5 22h13c1.381 0 2.5-1.119 2.5-2.5V9.679l1.318.824 1.06-1.696L12 1.696zM12 16.5c-1.933 0-3.5-1.567-3.5-3.5s1.567-3.5 3.5-3.5 3.5 1.567 3.5 3.5-1.567 3.5-3.5 3.5z" + "M12 1.696L.622 8.807l1.06 1.696L3 9.679V19.5C3 20.881 4.119 22 5.5 22h13c1.381 0 2.5-1.119 2.5-2.5V9.679l1.318.824 1.06-1.696L12 1.696zM12 16.5c-1.933 0-3.5-1.567-3.5-3.5s1.567-3.5 3.5-3.5 3.5 1.567 3.5 3.5-1.567 3.5-3.5 3.5z", }; const colors = { @@ -424,9 +424,15 @@ function postToTweetProfileTweets(langData) { 'div[role="tablist"] > div[role="presentation"]:nth-child(1) > a > div > div > span' ); - const isProfilePage = document.querySelector('div[data-testid="UserProfileHeader_Items"]') !== null + const isProfilePage = + document.querySelector('div[data-testid="UserProfileHeader_Items"]') !== + null; - if (profileTabPost !== null && profileTabPost.textContent !== tweets && isProfilePage) { + if ( + profileTabPost !== null && + profileTabPost.textContent !== tweets && + isProfilePage + ) { setTimeout(() => { if ( document.querySelector( @@ -557,7 +563,8 @@ function styleInject(head) { const verifiedSelectorMobile = `a[href="/i/verified-choose"] > div > svg > g > path`; const xLogoSelector = `path[d="${paths.xLogoPath}"]:not(${verifiedSelector}):not(${verifiedSelectorMobile})`; const xLogoDarkmodeSelector = `div[style="text-overflow: unset; color: rgb(239, 243, 244);"] > svg > g > path:not(${verifiedSelector}):not(${verifiedSelectorMobile})`; - const homeSelector = 'a[data-testid="AppTabBar_Home_Link"] > div > div > svg > g > path'; + const homeSelector = + 'a[data-testid="AppTabBar_Home_Link"] > div > div > svg > g > path'; style.innerHTML = ` .x-to-twitter { @@ -591,7 +598,15 @@ function styleInject(head) { ${homeSelector}:not(path[d="${paths.homeActivePath}"]) { d:path("${paths.oldHomePath}"); - } + } + + a[data-testid="SideNav_NewTweet_Button"], button[data-testid="tweetButtonInline"], button[data-testid="tweetButtonInline"], button[data-testid="tweetButton"] { + background-color: ${colors.twitterColor}!important; + } + + a[data-testid="SideNav_NewTweet_Button"] div[dir="ltr"], button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButton"] div[dir="ltr"] { + color: rgb(255, 255, 255)!important; + } `; head.appendChild(style); } @@ -622,11 +637,9 @@ function headFound(head) { postToTweet(); }, 100); - styleInject(head); titleChange(head); // i18nTest(); - } /** @@ -655,14 +668,16 @@ function trashSafari() { }); } - const homeicon = document.querySelector(`a[data-testid="AppTabBar_Home_Link"] > div > div > svg > g > path:not(.x-to-twitter-birdhome)`); - if(homeicon !== null) { + const homeicon = document.querySelector( + `a[data-testid="AppTabBar_Home_Link"] > div > div > svg > g > path:not(.x-to-twitter-birdhome)` + ); + if (homeicon !== null) { const d = homeicon.getAttribute("d"); - if(d === paths.homeActivePath) { - homeicon.setAttribute("d", paths.oldHomeActivePath) - } - if(d === paths.homePath) { - homeicon.setAttribute("d", paths.oldHomePath) + if (d === paths.homeActivePath) { + homeicon.setAttribute("d", paths.oldHomeActivePath); + } + if (d === paths.homePath) { + homeicon.setAttribute("d", paths.oldHomePath); } homeicon.classList.add("x-to-twitter-birdhome"); @@ -728,10 +743,10 @@ function main() { if (head !== null) { clearInterval(i); headFound(head); - + setTimeout(() => { replaceManifest(head); - }, 100) + }, 100); } }); } From d5ef7a3af402b9ee4733571ee6953ba9c356d83f Mon Sep 17 00:00:00 2001 From: yakisova41 Date: Sun, 8 Dec 2024 18:26:42 +0900 Subject: [PATCH 3/3] Remember svg color --- extension/userscript.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/userscript.user.js b/extension/userscript.user.js index c5e6fd6..6b50684 100644 --- a/extension/userscript.user.js +++ b/extension/userscript.user.js @@ -604,7 +604,7 @@ function styleInject(head) { background-color: ${colors.twitterColor}!important; } - a[data-testid="SideNav_NewTweet_Button"] div[dir="ltr"], button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButton"] div[dir="ltr"] { + a[data-testid="SideNav_NewTweet_Button"] div[dir="ltr"], a[data-testid="SideNav_NewTweet_Button"] > div[dir="ltr"] > svg, button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButtonInline"] div[dir="ltr"], button[data-testid="tweetButton"] div[dir="ltr"] { color: rgb(255, 255, 255)!important; } `;