Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move quote count to footer #520

Merged
merged 8 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,5 +574,6 @@
"show_quote_count": { "message": "Show quote count on tweets" },
"uploading": { "message": "Uploading" },
"finalization": { "message": "Finalization" },
"processing": { "message": "Processing" }
"processing": { "message": "Processing" },
"quotes": { "message": "Quotes" }
}
15 changes: 8 additions & 7 deletions _locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
"mute_videos": { "message": "비디오를 기본적으로 음소거합니다" },
"dont_pause_videos": { "message": "스크롤 할 때 비디오를 일시정지 하지 않습니다" },
"delete_for_you":{ "message": "나에게서 삭제", "description":"DM Message Delete menu"},
"show_user_previews_on_mobile": { "message": "계속 누를 시 유저 프로필을 보여줍니다 (이용에 방해될 수 있습니다)" },
"show_user_previews_on_mobile": { "message": "계속 누를 시 유저 프로필을 표시합니다 (이용에 방해될 수 있습니다)" },
"separate_text": { "message": "텍스트를 분리하기", "description": "This option appears in three-dot menu of tweets only on mobile and makes text bigger and adds padding on top and bottom on tap" },
"leave_conversation": {"message":"대화를 삭제하시거나 나가실건가요?"},
"autotranslation_help1": {"message": "이 기능은 버튼을 직접 누를 필요 없이 자동으로 트윗을 찾아 번역을 하는 기능입니다."},
Expand Down Expand Up @@ -549,7 +549,7 @@
"manage_searches": { "message": "검색 관리하기" },
"add_search": { "message": "검색 추가하기" },
"pinned_searches": { "message": "고정된 검색" },
"show_follower_counts_in_lists": { "message": "팔로우/팔로잉 페이지에서 팔로워의 수를 보여줍니다" },
"show_follower_counts_in_lists": { "message": "팔로우/팔로잉 페이지에서 팔로워의 수를 표시합니다" },
"not_possible_to_see_unfollowers": { "message": "아쉽게도, 50,000 명 이상의 팔로워를 가진 계정에 대해 언팔로우를 볼 수 없습니다." },
"sort_by_follow_date": { "message": "팔로우 한 날짜 순 정렬 (부정확)" },
"sort_by_followers": { "message": "팔로워 수 순 정렬" },
Expand All @@ -566,13 +566,14 @@
"descending": { "message": "내림차순" },
"search_by_name": { "message": "이름으로 검색" },
"search_by_description": { "message": "자기소개로 검색" },
"only_show_people_you_follow": { "message": "나를 팔로우 하는 사람만 보여줍니다" },
"only_show_people_with_followers": { "message": "최소 $NUMBER$ 팔로워를 가진 사람만 보여줍니다", "placeholders": { "number": { "content": "-1" } } },
"only_show_people_with_age": { "message": "$NUMBER$ 일 된 계정을 가진 사람만 보여줍니다", "placeholders": { "number": { "content": "-1" } } },
"only_show_people_you_follow": { "message": "나를 팔로우 하는 사람만 표시합니다" },
"only_show_people_with_followers": { "message": "최소 $NUMBER$ 팔로워를 가진 사람만 표시합니다", "placeholders": { "number": { "content": "-1" } } },
"only_show_people_with_age": { "message": "$NUMBER$ 일 된 계정을 가진 사람만 표시합니다", "placeholders": { "number": { "content": "-1" } } },
"page": { "message": "페이지" },
"update": {"message": "업데이트" },
"show_quote_count": { "message": "트윗의 인용 수를 보여줍니다" },
"show_quote_count": { "message": "트윗의 인용 수를 표시합니다" },
"uploading": { "message": "업로드 중" },
"finalization": { "message": "마무리 하는 중" },
"processing": { "message": "처리 중" }
"processing": { "message": "처리 중" },
"quotes": { "message": "인용" }
}
11 changes: 4 additions & 7 deletions layouts/header/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1972,9 +1972,6 @@ emoji-picker {
.tweet-interact-bookmark:before {
content: "\f093";
}
.tweet-interact-quote:before {
content: "\f029";
}
.user-verified::after {
content: "\f099";
color: #ee55a1;
Expand Down Expand Up @@ -2170,10 +2167,6 @@ emoji-picker {
.tweet-interact-bookmark:hover {
color: #3b918a !important
}
.tweet-interact-quote:hover:before,
.tweet-interact-quote:hover {
color: #913b8d !important
}

.tweet-birdwatch {
margin-top: 10px;
Expand Down Expand Up @@ -2351,6 +2344,10 @@ rt.furigana {
color: #00aced;
content: "\f012"
}
.ni-milestone:before {
color: #00aced;
content: "\f007"
}
.wtf-user-name {
max-width: 180px;
}
Expand Down
4 changes: 4 additions & 0 deletions layouts/lists/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,10 @@ a:hover,
color: #5c913b;
content: "\f006"
}
.ni-milestone:before {
color: #00aced;
content: "\f007"
}

.center-text {
background-color: var(--background-color);
Expand Down
4 changes: 4 additions & 0 deletions layouts/search/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ a:hover,
color: #5c913b;
content: "\f006"
}
.ni-milestone:before {
color: #00aced;
content: "\f007"
}

.center-text {
background-color: var(--background-color);
Expand Down
37 changes: 28 additions & 9 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,12 @@ async function appendTweet(t, timelineContainer, options = {}) {
<span class="tweet-footer-stat-text">${LOC.retweets.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-retweets">${formatLargeNumber(t.retweet_count).replace(/\s/g, ',')}</b>
</a>
${vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ?
/*html*/`<a href="https://twitter.com/${t.user.screen_name}/status/${t.id_str}/retweets/with_comments" class="tweet-footer-stat tweet-footer-stat-q">
<span class="tweet-footer-stat-text">${LOC.quotes.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-quotes">${formatLargeNumber(t.quote_count).replace(/\s/g, ',')}</b>
</a>` :
''}
<a href="https://twitter.com/${t.user.screen_name}/status/${t.id_str}/likes" class="tweet-footer-stat tweet-footer-stat-f">
<span class="tweet-footer-stat-text">${vars.heartsNotStars ? LOC.likes.message : LOC.favorites.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-favorites">${formatLargeNumber(t.favorite_count).replace(/\s/g, ',')}</b>
Expand All @@ -1915,9 +1921,6 @@ async function appendTweet(t, timelineContainer, options = {}) {
` : ''}
</div>
<span title="${vars.heartsNotStars ? LOC.like_btn.message : LOC.favorite_btn.message}${!vars.disableHotkeys ? ' (L)' : ''}" class="tweet-interact-favorite ${t.favorited ? 'tweet-interact-favorited' : ''}" data-val="${t.favorite_count}">${options.mainTweet ? '' : formatLargeNumber(t.favorite_count).replace(/\s/g, ',')}</span>
${vars.showQuoteCount && options.mainTweet && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ?
/*html*/`<span title="${LOC.quote_tweets.message}" class="tweet-interact-quote" data-val="${t.quote_count}">${formatLargeNumber(t.quote_count).replace(/\s/g, ',')}</span>` :
''}
${(vars.showBookmarkCount || options.mainTweet) && typeof t.bookmark_count !== 'undefined' ?
/*html*/`<span title="${LOC.bookmarks_count.message}${!vars.disableHotkeys ? ' (B)' : ''}" class="tweet-interact-bookmark${t.bookmarked ? ' tweet-interact-bookmarked' : ''}" data-val="${t.bookmark_count}">${formatLargeNumber(t.bookmark_count).replace(/\s/g, ',')}</span>` :
''}
Expand Down Expand Up @@ -2135,7 +2138,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
tweet.querySelector('.tweet-top').append(icon, span);
}
if(options.mainTweet) {
let likers = mainTweetLikers.slice(0, 8);
let likers = (vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ) ? mainTweetLikers.slice(0, 6) : mainTweetLikers.slice(0, 8);
for(let i in likers) {
let liker = likers[i];
let a = document.createElement('a');
Expand Down Expand Up @@ -2184,6 +2187,25 @@ async function appendTweet(t, timelineContainer, options = {}) {
renderTrends();
currentLocation = location.pathname;
});
if(vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0){
let quotesLink = tweet.getElementsByClassName('tweet-footer-stat-q')[0];
quotesLink.addEventListener('click', e => {
e.preventDefault();
document.getElementById('loading-box').hidden = false;
history.pushState({}, null, `https://twitter.com/${t.user.screen_name}/status/${t.id_str}/retweets/with_comments`);
updateSubpage();
mediaToUpload = [];
linkColors = {};
cursor = undefined;
seenReplies = [];
mainTweetLikers = [];
let id = location.pathname.match(/status\/(\d{1,32})/)[1];
updateRetweetsWithComments(id);
renderDiscovery();
renderTrends();
currentLocation = location.pathname;
});
}
let repliesLink = tweet.getElementsByClassName('tweet-footer-stat-o')[0];
repliesLink.addEventListener('click', e => {
e.preventDefault();
Expand Down Expand Up @@ -2257,7 +2279,6 @@ async function appendTweet(t, timelineContainer, options = {}) {
const tweetInteractReply = tweet.getElementsByClassName('tweet-interact-reply')[0];
const tweetInteractRetweet = tweet.getElementsByClassName('tweet-interact-retweet')[0];
const tweetInteractFavorite = tweet.getElementsByClassName('tweet-interact-favorite')[0];
const tweetInteractQuote = tweet.getElementsByClassName('tweet-interact-quote')[0];
const tweetInteractBookmark = tweet.getElementsByClassName('tweet-interact-bookmark')[0];
const tweetInteractMore = tweet.getElementsByClassName('tweet-interact-more')[0];

Expand Down Expand Up @@ -2619,9 +2640,6 @@ async function appendTweet(t, timelineContainer, options = {}) {
});
}
};
if(tweetInteractQuote) tweetInteractQuote.addEventListener('click', () => {
tweetInteractRetweetMenuQuotes.click();
});
if(tweetInteractBookmark) tweetInteractBookmark.addEventListener('click', switchBookmark);
if(tweetInteractMoreMenuBookmark) tweetInteractMoreMenuBookmark.addEventListener('click', switchBookmark);
if(tweetDeleteBookmark) tweetDeleteBookmark.addEventListener('click', async () => {
Expand Down Expand Up @@ -3572,7 +3590,8 @@ const iconClasses = {
'bird_icon': 'ni-twitter',
'security_alert_icon': 'ni-alert',
'bell_icon': 'ni-bell',
'list_icon': 'ni-list'
'list_icon': 'ni-list',
'milestone_icon': 'ni-milestone'
};
let aRegex = /<a[^>]*>([\s\S]*?)<\/a>/g;
let replacerLocs;
Expand Down
32 changes: 24 additions & 8 deletions scripts/tweetviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,12 @@ class TweetViewer {
<span class="tweet-footer-stat-text">${LOC.retweets.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-retweets">${formatLargeNumber(t.retweet_count).replace(/\s/g, ',')}</b>
</a>
${vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ? /*html*/
`<a href="https://twitter.com/${t.user.screen_name}/status/${t.id_str}/retweets/with_comments" class="tweet-footer-stat tweet-footer-stat-q">
<span class="tweet-footer-stat-text">${LOC.quotes.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-quotes">${formatLargeNumber(t.quote_count).replace(/\s/g, ',')}</b>
</a>` :
''}
<a href="https://twitter.com/${t.user.screen_name}/status/${t.id_str}/likes" class="tweet-footer-stat tweet-footer-stat-f">
<span class="tweet-footer-stat-text">${vars.heartsNotStars ? LOC.likes.message : LOC.favorites.message}</span>
<b class="tweet-footer-stat-count tweet-footer-stat-favorites">${formatLargeNumber(t.favorite_count).replace(/\s/g, ',')}</b>
Expand All @@ -1049,9 +1055,6 @@ class TweetViewer {
` : ''}
</div>
<span title="${vars.heartsNotStars ? LOC.like_btn.message : LOC.favorite_btn.message}${!vars.disableHotkeys ? ' (L)' : ''}" class="tweet-interact-favorite ${t.favorited ? 'tweet-interact-favorited' : ''}" data-val="${t.favorite_count}">${options.mainTweet ? '' : formatLargeNumber(t.favorite_count).replace(/\s/g, ',')}</span>
${vars.showQuoteCount && options.mainTweet && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ?
/*html*/`<span title="${LOC.quote_tweets.message}" class="tweet-interact-quote" data-val="${t.quote_count}">${formatLargeNumber(t.quote_count).replace(/\s/g, ',')}</span>` :
''}
${(vars.showBookmarkCount || options.mainTweet) && typeof t.bookmark_count !== 'undefined' ?
/*html*/`<span title="${LOC.bookmarks_count.message}" class="tweet-interact-bookmark${t.bookmarked ? ' tweet-interact-bookmarked' : ''}" data-val="${t.bookmark_count}">${formatLargeNumber(t.bookmark_count).replace(/\s/g, ',')}</span>` :
''}
Expand Down Expand Up @@ -1244,7 +1247,7 @@ class TweetViewer {
tweet.querySelector('.tweet-top').append(icon, span);
}
if(options.mainTweet) {
let likers = this.mainTweetLikers.slice(0, 8);
let likers = (vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0 ) ? this.mainTweetLikers.slice(0, 6) : this.mainTweetLikers.slice(0, 8);
for(let i in likers) {
let liker = likers[i];
let a = document.createElement('a');
Expand Down Expand Up @@ -1289,6 +1292,23 @@ class TweetViewer {
this.updateRetweets(id);
this.currentLocation = location.pathname;
});
if(vars.showQuoteCount && typeof t.quote_count !== 'undefined' && t.quote_count > 0){
let quotesLink = tweet.getElementsByClassName('tweet-footer-stat-q')[0];
quotesLink.addEventListener('click', e => {
e.preventDefault();
history.pushState({}, null, `https://twitter.com/${t.user.screen_name}/status/${t.id_str}/retweets/with_comments`);
this.updateSubpage();
this.mediaToUpload = [];
this.excludeUserMentions = [];
this.linkColors = {};
this.cursor = undefined;
this.seenReplies = [];
this.mainTweetLikers = [];
let id = location.pathname.match(/status\/(\d{1,32})/)[1];
this.updateRetweetsWithComments(id);
this.currentLocation = location.pathname;
});
}
let repliesLink = tweet.getElementsByClassName('tweet-footer-stat-o')[0];
repliesLink.addEventListener('click', e => {
e.preventDefault();
Expand Down Expand Up @@ -1345,7 +1365,6 @@ class TweetViewer {
const tweetInteractReply = tweet.getElementsByClassName('tweet-interact-reply')[0];
const tweetInteractRetweet = tweet.getElementsByClassName('tweet-interact-retweet')[0];
const tweetInteractFavorite = tweet.getElementsByClassName('tweet-interact-favorite')[0];
const tweetInteractQuote = tweet.getElementsByClassName('tweet-interact-quote')[0];
const tweetInteractBookmark = tweet.getElementsByClassName('tweet-interact-bookmark')[0];
const tweetInteractMore = tweet.getElementsByClassName('tweet-interact-more')[0];

Expand Down Expand Up @@ -1661,9 +1680,6 @@ class TweetViewer {
});
}
};
if(tweetInteractQuote) tweetInteractQuote.addEventListener('click', () => {
tweetInteractRetweetMenuQuotes.click();
});
if(tweetInteractBookmark) tweetInteractBookmark.addEventListener('click', switchBookmark);
if(tweetInteractMoreMenuBookmark) tweetInteractMoreMenuBookmark.addEventListener('click', switchBookmark);

Expand Down