Skip to content

Commit

Permalink
added some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Aug 2, 2022
1 parent 0ec3781 commit 7cd02d5
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 2 deletions.
5 changes: 5 additions & 0 deletions layouts/home/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ async function appendTweet(t, timelineContainer, options = {}) {
` : ''}
</a>
` : ``}
${t.limited_actions === 'limit_trusted_friends_tweet' ? `
<div class="tweet-limited">
This tweet is visible only to people who are in @${t.user.screen_name}'s trusted friends circle. <a href="https://help.twitter.com/en/using-twitter/twitter-circle" target="_blank">Learn more.</a>
</div>
` : ''}
${options.selfThreadButton && t.self_thread.id_str ? `<br><a class="tweet-self-thread-button" target="_blank" href="https://twitter.com/${t.user.screen_name}/status/${t.self_thread.id_str}">Show this thread</a>` : ``}
<div class="tweet-interact">
<span class="tweet-interact-reply">${t.reply_count}</span>
Expand Down
7 changes: 7 additions & 0 deletions layouts/home/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1001,4 +1001,11 @@ a:hover,
}
.tweet-self-thread-div {
margin-top: -5px;
}
.tweet-limited {
background-color: rgba(0, 255, 0, 0.05);
border-radius: 5px;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
5 changes: 5 additions & 0 deletions layouts/profile/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,11 @@ async function appendTweet(t, timelineContainer, options = {}) {
` : ''}
</a>
` : ``}
${t.limited_actions === 'limit_trusted_friends_tweet' ? `
<div class="tweet-limited">
This tweet is visible only to people who are in @${t.user.screen_name}'s trusted friends circle. <a href="https://help.twitter.com/en/using-twitter/twitter-circle" target="_blank">Learn more.</a>
</div>
` : ''}
${options.selfThreadButton && t.self_thread.id_str ? `<br><a class="tweet-self-thread-button" target="_blank" href="https://twitter.com/${t.user.screen_name}/status/${t.self_thread.id_str}">Show this thread</a>` : ``}
<div class="tweet-interact">
<span class="tweet-interact-reply">${t.reply_count}</span>
Expand Down
14 changes: 14 additions & 0 deletions layouts/profile/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1405,4 +1405,18 @@ a:hover,
}
.tweet-self-thread-div {
margin-top: -5px;
}
.tweet-warning {
background-color: rgba(255, 0, 0, 0.05);
border-radius: 5px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
}
.tweet-limited {
background-color: rgba(0, 255, 0, 0.05);
border-radius: 5px;
padding: 10px;
margin-top: 5px;
margin-bottom: 5px;
}
9 changes: 8 additions & 1 deletion layouts/tweet/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function updateReplies(id, c) {
mainTweet: true
});
}
appendComposeComponent(document.getElementById('timeline'), t.data);
if(t.data.limited_actions !== "non_compliant") appendComposeComponent(document.getElementById('timeline'), t.data);
}
if(t.type === 'tweet') {
await appendTweet(t.data, document.getElementById('timeline'), {
Expand Down Expand Up @@ -705,6 +705,13 @@ async function appendTweet(t, timelineContainer, options = {}) {
` : ''}
</a>
` : ``}
${t.limited_actions === 'limit_trusted_friends_tweet' && options.mainTweet ? `
<div class="tweet-limited">
This tweet is visible only to people who are in @${t.user.screen_name}'s trusted friends circle.<br>
<a href="https://help.twitter.com/en/using-twitter/twitter-circle" target="_blank">Learn more.</a>
</div>
` : ''}
${t.tombstone ? `<div class="tweet-warning">${t.tombstone}</div>` : ''}
${options.mainTweet ? /*html*/`
<div class="tweet-footer">
<div class="tweet-footer-stats">
Expand Down
14 changes: 14 additions & 0 deletions layouts/tweet/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1108,4 +1108,18 @@ a:hover,

.tweet-header-name-main {
width: 300px;
}
.tweet-limited {
background-color: rgba(0, 255, 0, 0.05);
border-radius: 5px;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
.tweet-warning {
background-color: rgba(255, 0, 0, 0.05);
border-radius: 5px;
padding: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
2 changes: 1 addition & 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.3.6",
"version": "1.3.7",
"manifest_version": 3,
"homepage_url": "https://github.com/dimdenGD/OldTwitter",
"background": {
Expand Down
16 changes: 16 additions & 0 deletions scripts/apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,22 @@ API.getReplies = (id, cursor) => {
type: tweet.id_str === id ? 'mainTweet' : 'tweet',
data: tweet
});
} else if (e.entryId.startsWith('tombstone-')) {
let tweet = tweetData[e.content.item.content.tombstone.tweet.id];
let user = userData[tweet.user_id_str];
tweet.id_str = e.content.item.content.tombstone.tweet.id;
tweet.user = user;
if(tweet.quoted_status_id_str) {
tweet.quoted_status = tweetData[tweet.quoted_status_id_str];
tweet.quoted_status.user = userData[tweet.quoted_status.user_id_str];
tweet.quoted_status.user.id_str = tweet.quoted_status.user_id_str;
tweet.quoted_status.id_str = tweet.quoted_status_id_str;
}
tweet.tombstone = e.content.item.content.tombstone.tombstoneInfo.text;
list.push({
type: tweet.id_str === id ? 'mainTweet' : 'tweet',
data: tweet
});
} else if(e.entryId.startsWith('conversationThread-')) {
let thread = e.content.item.content.conversationThread.conversationComponents.filter(c => c.conversationTweetComponent);
let threadList = [];
Expand Down

0 comments on commit 7cd02d5

Please sign in to comment.