Skip to content

Commit

Permalink
old/new switch buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Aug 15, 2022
1 parent 5e275a5 commit 4603b93
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 8 deletions.
18 changes: 17 additions & 1 deletion layouts/header/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,13 +1180,29 @@ setTimeout(async () => {
userDataFunction({ detail: u });
});
}
}, 5000);
setTimeout(() => {
let version = document.getElementById('oldtwitter-version');
if(version) {
fetch(`https://raw.githubusercontent.com/dimdenGD/OldTwitter/master/manifest.json?t=${Date.now()}`).then(res => res.json()).then(res => {
version.innerText += ` (last version: ${res.version})`;
});
}
}, 5000);
let about = document.getElementById('about');
if(about) {
let a = document.createElement('a');
a.href = location.href.replace('twitter.com', 'mobile.twitter.com');
setInterval(() => {
a.href = location.href.replace('twitter.com', 'mobile.twitter.com');
}, 500);
a.innerText = '[Open this page in new Twitter]';
a.addEventListener('click', e => {
e.stopImmediatePropagation();
});
a.style.color = 'var(--light-gray)';
about.appendChild(a);
}
}, 500);
document.addEventListener('updateUserData', userDataFunction);

let root = document.querySelector(":root");
Expand Down
1 change: 1 addition & 0 deletions layouts/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ <h1>Who to follow</h1><br>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/home/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ a:hover,
color: var(--light-gray);
font-size: 12px;
margin-top: 5px;
padding: 10px
padding: 10px 3px;
}

.about-links a,
Expand Down
1 change: 1 addition & 0 deletions layouts/notifications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ <h1>Who to follow</h1><br>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/notifications/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ a:hover,
color: var(--light-gray);
font-size: 12px;
margin-top: 5px;
padding: 10px
padding: 10px 3px;
}

.about-links a,
Expand Down
1 change: 1 addition & 0 deletions layouts/profile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ <h1 style="margin-bottom:5px;">Trends</h1>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/profile/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ a:hover,

#about {
margin-top: 5px;
padding: 10px;
padding: 10px 3px;
font-size: 12px;
color: var(--light-gray)
}
Expand Down
1 change: 1 addition & 0 deletions layouts/search/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h1>Who to follow</h1><br>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/search/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ a:hover,
color: var(--light-gray);
font-size: 12px;
margin-top: 5px;
padding: 10px
padding: 10px 3px;
}

.about-links a,
Expand Down
1 change: 1 addition & 0 deletions layouts/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ <h1>Who to follow</h1><br>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/settings/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ body {
}
#about {
margin-top: 5px;
padding: 10px;
padding: 10px 3px;
font-size: 12px;
color: var(--light-gray);
}
Expand Down
1 change: 1 addition & 0 deletions layouts/tweet/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ <h1>Who to follow</h1><br>
<a href="/tos">Terms</a>
<a href="/privacy">Privacy</a>
</div>
<br>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/tweet/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ a:hover,
color: var(--light-gray);
font-size: 12px;
margin-top: 5px;
padding: 10px
padding: 10px 3px;
}

.about-links a,
Expand Down
8 changes: 7 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Old Twitter Layout (2022)",
"description": "A new extension that returns old Twitter's look.",
"version": "1.4.3",
"version": "1.4.4",
"manifest_version": 3,
"homepage_url": "https://github.com/dimdenGD/OldTwitter",
"background": {
Expand Down Expand Up @@ -67,6 +67,12 @@
}
},
"content_scripts": [
{
"matches": ["https://mobile.twitter.com/*"],
"js": ["scripts/newtwitter.js"],
"all_frames": true,
"run_at": "document_end"
},
{
"matches": ["https://twitter.com/*"],
"js": ["scripts/config.js", "scripts/apis.js", "scripts/content.js"],
Expand Down
8 changes: 8 additions & 0 deletions scripts/newtwitter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let r = document.createElement('a');
r.href = location.href.replace('mobile.twitter.com', 'twitter.com');
setInterval(() => {
r.href = location.href.replace('mobile.twitter.com', 'twitter.com');
}, 500);
r.textContent = 'Open this page in OldTwitter';
r.style.cssText = 'position: fixed; top: 0; right: 10px; padding: 0.5em; background: #fff; color: #000; font-family: Arial, sans-serif;border-radius:3px;';
document.body.appendChild(r);

0 comments on commit 4603b93

Please sign in to comment.