Skip to content

Commit

Permalink
chore: release 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Oct 14, 2023
1 parent f09b08f commit 94186fb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
29 changes: 24 additions & 5 deletions dist/twitter.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Get Twitter Icons Back
// @namespace Pionxzh
// @version 1.7.0
// @version 1.8.0
// @author Pionxzh
// @description Brings back the blue bird icon on Twitter. No more 𝕏.
// @license MIT
Expand All @@ -24,6 +24,7 @@
const xHouseActiveIconPath = "M21.591 7.146L12.52 1.157c-.316-.21-.724-.21-1.04 0l-9.071 5.99c-.26.173-.409.456-.409.757v13.183c0 .502.418.913.929.913H9.14c.51 0 .929-.41.929-.913v-7.075h3.909v7.075c0 .502.417.913.928.913h6.165c.511 0 .929-.41.929-.913V7.904c0-.301-.158-.584-.408-.758z";
const twitterHomeIconPath = "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";
const twitterHomeActiveIconPath = "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 twitterBlueIconPath = "M15.704 8.99c.457-.05.891-.17 1.296-.35-.302.45-.685.84-1.125 1.15.004.1.006.19.006.29 0 2.94-2.269 6.32-6.421 6.32-1.274 0-2.46-.37-3.459-1 .177.02.357.03.539.03 1.057 0 2.03-.35 2.803-.95-.988-.02-1.821-.66-2.109-1.54.138.03.28.04.425.04.206 0 .405-.03.595-.08-1.033-.2-1.811-1.1-1.811-2.18v-.03c.305.17.652.27 1.023.28-.606-.4-1.004-1.08-1.004-1.85 0-.4.111-.78.305-1.11 1.113 1.34 2.775 2.22 4.652 2.32-.038-.17-.058-.33-.058-.51 0-1.23 1.01-2.22 2.256-2.22.649 0 1.235.27 1.647.7.514-.1.997-.28 1.433-.54-.168.52-.526.96-.992 1.23zM2 21h15c3.038 0 5.5-2.46 5.5-5.5 0-1.4-.524-2.68-1.385-3.65-.08-.09-.089-.22-.023-.32.574-.87.908-1.91.908-3.03C22 5.46 19.538 3 16.5 3H2v18zM16.5 5C18.433 5 20 6.57 20 8.5c0 1.01-.43 1.93-1.12 2.57-.468.43-.414 1.19.111 1.55.914.63 1.509 1.69 1.509 2.88 0 1.93-1.567 3.5-3.5 3.5H4V5h12.5z";
const twitterBlue = "rgb(29,155,240)";
const twitterGray = "rgb(231,233,234)";
const linkMap = {
Expand Down Expand Up @@ -82,6 +83,10 @@ svg > g > path[d='${xHouseActiveIconPath}'] {
d: path('${twitterHomeActiveIconPath}');
}
a[aria-label="Premium"] svg > g > path {
d: path('${twitterBlueIconPath}');
}
#placeholder > svg,
h1 a[href='/home'] svg,
svg[data-testid="icon-verified"],
Expand All @@ -92,7 +97,21 @@ svg[data-testid="icon-verified"],
[data-color-scheme="dark"] h1 a[href='/home'] svg {
color: ${twitterGray};
}`;
}
a[aria-label="Premium"] > div > div[dir] {
text-overflow: clip;
}
a[aria-label="Premium"] > div > div[dir] > span {
visibility: hidden;
}
a[aria-label="Premium"] > div > div[dir] > span:before {
visibility: visible;
content: "Twitter Blue";
}
`;
document.head.appendChild(style);
}
const mutationObserverOptions = { subtree: true, characterData: true, childList: true, attributes: true };
Expand Down Expand Up @@ -141,9 +160,9 @@ svg[data-testid="icon-verified"],
async function monitorTitle() {
const titleEl = await waitForElement("head > title");
const sync = () => {
if (document.title.endsWith(" / X")) {
document.title = `${document.title.slice(0, -1)}Twitter`;
}
const newTitle = document.title.replace(/ on X:/, " on Twitter:").replace(/X /, "Twitter 上的").replace(/ \/ X$/, " / Twitter").replace(/^X$/, "Twitter").replace(/^\((\d+)\) X$/, "($1) Twitter");
if (newTitle !== document.title)
document.title = newTitle;
};
sync();
window.addEventListener("visibilitychange", sync);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pionxzh/get-twitter-icons-back",
"type": "module",
"version": "1.7.0",
"version": "1.8.0",
"private": true,
"packageManager": "[email protected]",
"title": "Get Twitter Icons Back",
Expand Down

0 comments on commit 94186fb

Please sign in to comment.