Skip to content

Commit

Permalink
chore: release 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Jul 28, 2023
1 parent 4bac052 commit 435900e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 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.4.0
// @version 1.4.1
// @author Pionxzh
// @description Brings back the blue bird icon on Twitter. No more 𝕏.
// @license MIT
Expand Down Expand Up @@ -230,18 +230,33 @@
}
});
}
function replaceTitle() {
const title = document.querySelector("title");
if (!title)
return;
async function waitForTitle() {
return new Promise((resolve) => {
const title = document.querySelector("title");
if (title) {
resolve(title);
} else {
const observer = new MutationObserver(() => {
const title2 = document.querySelector("title");
if (title2) {
observer.disconnect();
resolve(title2);
}
});
observer.observe(document.head, { childList: true });
}
});
}
async function replaceTitle() {
const el = await waitForTitle();
const sync = () => {
if (document.title.endsWith(" / X")) {
document.title = `${document.title.slice(0, -1)}Twitter`;
}
};
sync();
window.addEventListener("visibilitychange", sync);
new MutationObserver(sync).observe(title, mutationObserverOptions);
new MutationObserver(sync).observe(el, mutationObserverOptions);
}
main();

Expand Down
2 changes: 1 addition & 1 deletion packages/userscript/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pionxzh/twitter-icon-userscript",
"type": "module",
"version": "1.4.0",
"version": "1.4.1",
"private": true,
"title": "Get Twitter Icons Back",
"description": "Brings back the blue bird icon on Twitter. No more 𝕏.",
Expand Down

0 comments on commit 435900e

Please sign in to comment.