1const startUrl = "https://x.com/";
2const homeUrl = "https://x.com/home";
3const postUrl = "{{post_url}}";
4
5//Click Sign-in by Google button to trigger google init script and prepare it for user clicking
6function clickGoogleAuthButtonIfPresent() {
7 const googleAuthButton = document.querySelector(
8 '[data-testid*="google_placeholder_button"]',
9 );
10 if (googleAuthButton !== null) {
11 googleAuthButton.click();
12 }
13}
14
15window.onload = function () {
16 setTimeout(clickGoogleAuthButtonIfPresent, 100);
17
18 console.log(
19 "JavaScriptNavigator: selecting action for " + window.location.href,
20 );
21 switch (window.location.href) {
22 case startUrl:
23 setInterval(() => {
24 if (window.location.href === homeUrl) {
25 window.location.href = postUrl;
26 }
27 }, 1000);
28 break;
29 case homeUrl:
30 window.location.href = postUrl;
31 break;
32 default:
33 break;
34 }
35};
36