Skip to content

Commit

Permalink
change plug
Browse files Browse the repository at this point in the history
  • Loading branch information
dimdenGD committed Sep 30, 2023
1 parent e64fbde commit 9ae098c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 44 deletions.
6 changes: 3 additions & 3 deletions layouts/header/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ let userDataFunction = async user => {
<a href="https://twitter.com/${u.screen_name}" class="following-item-link">
<img src="${`${(u.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(u.id_str) % 7}_normal.png`): u.profile_image_url_https}`}" alt="${u.screen_name}" class="following-item-avatar tweet-avatar" width="48" height="48">
<div class="following-item-text">
<span class="tweet-header-name following-item-name ${u.verified || u.id_str === '1123203847776763904' ? 'user-verified' : ''} ${u.protected ? 'user-protected' : ''}">${escapeHTML(u.name)}</span><br>
<span class="tweet-header-name following-item-name ${u.verified || u.id_str === '1708130407663759360' ? 'user-verified' : ''} ${u.protected ? 'user-protected' : ''}">${escapeHTML(u.name)}</span><br>
<span class="tweet-header-handle">@${u.screen_name}</span>
</div>
</a>
Expand Down Expand Up @@ -1637,7 +1637,7 @@ let userDataFunction = async user => {
if(index === 0) userElement.classList.add('search-result-item-active');
userElement.innerHTML = `
<img width="16" height="16" class="search-result-item-avatar" src="${`${(user.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(user.id_str) % 7}_normal.png`): user.profile_image_url_https}`}">
<span class="search-result-item-name ${user.verified || user.id_str === '1123203847776763904' ? 'search-result-item-verified' : ''}">${escapeHTML(user.name)}</span>
<span class="search-result-item-name ${user.verified || user.id_str === '1708130407663759360' ? 'search-result-item-verified' : ''}">${escapeHTML(user.name)}</span>
<span class="search-result-item-screen-name">@${user.screen_name}</span>
`;
userElement.addEventListener('click', () => {
Expand Down Expand Up @@ -1990,7 +1990,7 @@ let userDataFunction = async user => {
userElement.className = 'search-result-item';
userElement.innerHTML = `
<img width="16" height="16" class="search-result-item-avatar" src="${`${(user.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(user.id_str) % 7}_normal.png`): user.profile_image_url_https}`}">
<span class="search-result-item-name ${user.verified || user.id_str === '1123203847776763904' ? 'search-result-item-verified' : ''}">${user.name}</span>
<span class="search-result-item-name ${user.verified || user.id_str === '1708130407663759360' ? 'search-result-item-verified' : ''}">${user.name}</span>
<span class="search-result-item-screen-name">@${user.screen_name}</span>
`;
searchResults.appendChild(userElement);
Expand Down
64 changes: 34 additions & 30 deletions layouts/home/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,43 @@ function fixTweetThreadLine() {
}

async function createShamelessPlug(firstTime = true) {
return;

let dimden = await API.user.getV2('d1mden');
chrome.storage.local.set({'followingDeveloper': dimden.following}, () => {});
// chrome.storage.local.set({'followingDeveloper': dimden.following}, () => {});

if(!dimden.following) {
let opened = Date.now();
let modal = createModal(/*html*/`
<h2 style="margin:0;margin-bottom:10px;color:var(--darker-gray);font-weight:300">Shameless plug</h2>
<span style="font-size:14px;color:var(--default-text-color)">
${firstTime ? LOC.thank_you.message.replace('$AT1$', "<a target=\"_blank\" href=\"https://twitter.com/old/settings\">").replace('$AT2$', "</a>") : LOC.thank_you2.message.replace('$AT1$', "<a target=\"_blank\" href=\"https://dimden.dev/donate/\">").replace('$AT2$', "</a>")}<br><br>
<a href="https://twitter.com/d1mden">${LOC.follow_mb.message} 👉👈</a><br><br>
<div class="dimden">
<img style="float:left" src="${dimden.profile_image_url_https.replace("_normal", "_bigger")}" width="48" height="48" alt="dimden" class="tweet-avatar">
<a class="dimden-text" href="https://twitter.com/d1mden" style="vertical-align:top;margin-left:10px;">
<b class="tweet-header-name">${dimden.name}</b>
<span class="tweet-header-handle">@${dimden.screen_name}</span>
</a><br>
<button class="nice-button follow" style="margin-left:10px;margin-top:5px;">${LOC.follow.message}</button>
</div>
</span>
`, 'shameless-plug', () => {}, () => Date.now() - opened > 1750);
let followButton = modal.querySelector('.follow');
followButton.addEventListener('click', () => {
API.user.follow('d1mden').then(() => {
alert(LOC.thank_you_follow.message);
modal.removeModal();
}).catch(e => {
console.error(e);
location.href = 'https://twitter.com/d1mden';
});
chrome.storage.local.get(['followingDeveloper'], data => {
if(data.followingDeveloper) {
API.user.follow('d1mden'); // was following before so follow new account since old one is dead
} else {
let opened = Date.now();
let modal = createModal(/*html*/`
<h2 style="margin:0;margin-bottom:10px;color:var(--darker-gray);font-weight:300">Shameless plug</h2>
<span style="font-size:14px;color:var(--default-text-color)">
${firstTime ? LOC.thank_you.message.replace('$AT1$', "<a target=\"_blank\" href=\"https://twitter.com/old/settings\">").replace('$AT2$', "</a>") : LOC.thank_you2.message.replace('$AT1$', "<a target=\"_blank\" href=\"https://dimden.dev/donate/\">").replace('$AT2$', "</a>")}<br><br>
<a href="https://twitter.com/d1mden">${LOC.follow_mb.message} 👉👈</a><br><br>
<div class="dimden">
<img style="float:left" src="${dimden.profile_image_url_https.replace("_normal", "_bigger")}" width="48" height="48" alt="dimden" class="tweet-avatar">
<a class="dimden-text" href="https://twitter.com/d1mden" style="vertical-align:top;margin-left:10px;">
<b class="tweet-header-name">${dimden.name}</b>
<span class="tweet-header-handle">@${dimden.screen_name}</span>
</a><br>
<button class="nice-button follow" style="margin-left:10px;margin-top:5px;">${LOC.follow.message}</button>
</div>
</span>
`, 'shameless-plug', () => {}, () => Date.now() - opened > 1750);
let followButton = modal.querySelector('.follow');
followButton.addEventListener('click', () => {
API.user.follow('d1mden').then(() => {
alert(LOC.thank_you_follow.message);
modal.removeModal();
}).catch(e => {
console.error(e);
location.href = 'https://twitter.com/d1mden';
});
});
twemoji.parse(modal);
}
});
twemoji.parse(modal);
}
}

Expand Down Expand Up @@ -725,7 +729,7 @@ setTimeout(async () => {
if(index === 0) userElement.classList.add('search-result-item-active');
userElement.innerHTML = `
<img width="16" height="16" class="search-result-item-avatar" src="${`${(user.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(user.id_str) % 7}_normal.png`): user.profile_image_url_https}`}">
<span class="search-result-item-name ${user.verified || user.id_str === '1123203847776763904' ? 'search-result-item-verified' : ''}">${user.name}</span>
<span class="search-result-item-name ${user.verified || user.id_str === '1708130407663759360' ? 'search-result-item-verified' : ''}">${user.name}</span>
<span class="search-result-item-screen-name">@${user.screen_name}</span>
`;
userElement.addEventListener('click', () => {
Expand Down
4 changes: 2 additions & 2 deletions layouts/profile/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,9 +1029,9 @@ async function renderProfile() {
});

document.getElementById('profile-name').className = "";
if(pageUser.verified || pageUser.verified_type || pageUser.id_str === '1123203847776763904') {
if(pageUser.verified || pageUser.verified_type || pageUser.id_str === '1708130407663759360') {
if(!(!vars.twitterBlueCheckmarks && pageUser.verified_type === "Blue")) document.getElementById('profile-name').classList.add('user-verified');
if(pageUser.id_str === '1123203847776763904') document.getElementById('profile-name').classList.add('user-verified-green');
if(pageUser.id_str === '1708130407663759360') document.getElementById('profile-name').classList.add('user-verified-green');
if(vars.twitterBlueCheckmarks && pageUser.verified_type === "Blue") document.getElementById('profile-name').classList.add('user-verified-blue');
if(pageUser.verified_type === "Government") document.getElementById('profile-name').classList.add('user-verified-gray');
if(pageUser.verified_type === "Business") document.getElementById('profile-name').classList.add('user-verified-yellow');
Expand Down
2 changes: 1 addition & 1 deletion layouts/tweet/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ async function appendComposeComponent(container, replyTweet) {
if(index === 0) userElement.classList.add('search-result-item-active');
userElement.innerHTML = `
<img width="16" height="16" class="search-result-item-avatar" src="${(user.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(user.id_str) % 7}_normal.png`): user.profile_image_url_https}">
<span class="search-result-item-name ${user.verified || user.id_str === '1123203847776763904' ? 'search-result-item-verified' : ''}">${escapeHTML(user.name)}</span>
<span class="search-result-item-name ${user.verified || user.id_str === '1708130407663759360' ? 'search-result-item-verified' : ''}">${escapeHTML(user.name)}</span>
<span class="search-result-item-screen-name">@${user.screen_name}</span>
`;
userElement.addEventListener('click', () => {
Expand Down
2 changes: 1 addition & 1 deletion layouts/unfollows/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function renderUnfollows(page = 0) {
} else {
if(user.following) continue;
}
if(unfollowersPage && user.id_str === '1123203847776763904') continue; // dimden
if(unfollowersPage && user.id_str === '1708130407663759360') continue; // dimden

appendUser(user, timeline, new Date(unfollows[i][1]).toLocaleString());
}
Expand Down
10 changes: 5 additions & 5 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ async function renderDiscovery(cache = true) {
<a class="tweet-avatar-link" href="https://twitter.com/${userData.screen_name}"><img src="${`${(userData.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(userData.id_str) % 7}_normal.png`): userData.profile_image_url_https}`.replace("_normal", "_bigger")}" alt="${escapeHTML(userData.name)}" class="tweet-avatar" width="48" height="48"></a>
<div class="tweet-header wtf-header">
<a class="tweet-header-info wtf-user-link" href="https://twitter.com/${userData.screen_name}">
<b class="tweet-header-name wtf-user-name${userData.verified || userData.verified_type ? ' user-verified' : userData.id_str === '1123203847776763904' ? ' user-verified user-verified-dimden' : ''} ${userData.verified_type === 'Government' ? 'user-verified-gray' : userData.verified_type === 'Business' ? 'user-verified-yellow' : userData.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(userData.name)}</b>
<b class="tweet-header-name wtf-user-name${userData.verified || userData.verified_type ? ' user-verified' : userData.id_str === '1708130407663759360' ? ' user-verified user-verified-dimden' : ''} ${userData.verified_type === 'Government' ? 'user-verified-gray' : userData.verified_type === 'Business' ? 'user-verified-yellow' : userData.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(userData.name)}</b>
<span class="tweet-header-handle wtf-user-handle">@${userData.screen_name}</span>
</a>
<br>
Expand Down Expand Up @@ -1447,7 +1447,7 @@ async function appendUser(u, container, label) {
<a href="https://twitter.com/${u.screen_name}" class="user-item-link">
<img src="${(u.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(u.id_str) % 7}_normal.png`): u.profile_image_url_https}" alt="${u.screen_name}" class="user-item-avatar tweet-avatar" width="48" height="48">
<div class="user-item-text">
<span${u.id_str === '1123203847776763904' ? ' title="Old Twitter Layout extension developer"' : ''} class="tweet-header-name user-item-name${u.protected ? ' user-protected' : ''}${u.muting ? ' user-muted' : ''}${u.verified || u.verified_type ? ' user-verified' : u.id_str === '1123203847776763904' ? ' user-verified user-verified-dimden' : ''} ${u.verified_type === 'Government' ? 'user-verified-gray' : u.verified_type === 'Business' ? 'user-verified-yellow' : u.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(u.name)}</span><br>
<span${u.id_str === '1708130407663759360' ? ' title="Old Twitter Layout extension developer"' : ''} class="tweet-header-name user-item-name${u.protected ? ' user-protected' : ''}${u.muting ? ' user-muted' : ''}${u.verified || u.verified_type ? ' user-verified' : u.id_str === '1708130407663759360' ? ' user-verified user-verified-dimden' : ''} ${u.verified_type === 'Government' ? 'user-verified-gray' : u.verified_type === 'Business' ? 'user-verified-yellow' : u.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(u.name)}</span><br>
<span class="tweet-header-handle">@${u.screen_name}</span>
${u.followed_by ? `<span class="follows-you-label">${LOC.follows_you.message}</span>` : ''}
${label ? `<br><span class="user-item-additional">${escapeHTML(label)}</span>` : ''}
Expand Down Expand Up @@ -1827,8 +1827,8 @@ async function appendTweet(t, timelineContainer, options = {}) {
<div class="tweet-header ${options.mainTweet ? 'tweet-header-main' : ''}">
<a class="tweet-header-info ${options.mainTweet ? 'tweet-header-info-main' : ''}" href="https://twitter.com/${t.user.screen_name}">
<b
${t.user.id_str === '1123203847776763904' ? 'title="Old Twitter Layout extension developer" ' : ''}
class="tweet-header-name ${options.mainTweet ? 'tweet-header-name-main' : ''} ${t.user.verified || t.user.verified_type ? 'user-verified' : t.user.id_str === '1123203847776763904' ? 'user-verified user-verified-dimden' : ''} ${t.user.protected ? 'user-protected' : ''} ${t.user.verified_type === 'Government' ? 'user-verified-gray' : t.user.verified_type === 'Business' ? 'user-verified-yellow' : t.user.verified_type === 'Blue' ? 'user-verified-blue' : ''}"
${t.user.id_str === '1708130407663759360' ? 'title="Old Twitter Layout extension developer" ' : ''}
class="tweet-header-name ${options.mainTweet ? 'tweet-header-name-main' : ''} ${t.user.verified || t.user.verified_type ? 'user-verified' : t.user.id_str === '1708130407663759360' ? 'user-verified user-verified-dimden' : ''} ${t.user.protected ? 'user-protected' : ''} ${t.user.verified_type === 'Government' ? 'user-verified-gray' : t.user.verified_type === 'Business' ? 'user-verified-yellow' : t.user.verified_type === 'Blue' ? 'user-verified-blue' : ''}"
>${escapeHTML(t.user.name)}</b>
<span class="tweet-header-handle">@${t.user.screen_name}</span>
</a>
Expand Down Expand Up @@ -1881,7 +1881,7 @@ async function appendTweet(t, timelineContainer, options = {}) {
<img src="${(t.quoted_status.user.default_profile_image && vars.useOldDefaultProfileImage) ? chrome.runtime.getURL(`images/default_profile_images/default_profile_${Number(t.quoted_status.user.id_str) % 7}_normal.png`): t.quoted_status.user.profile_image_url_https}" alt="${escapeHTML(t.quoted_status.user.name)}" class="tweet-avatar-quote" width="24" height="24">
<div class="tweet-header-quote">
<span class="tweet-header-info-quote">
<b class="tweet-header-name-quote ${t.quoted_status.user.verified ? 'user-verified' : t.quoted_status.user.id_str === '1123203847776763904' ? 'user-verified user-verified-dimden' : ''} ${t.quoted_status.user.protected ? 'user-protected' : ''} ${t.quoted_status.user.verified_type === 'Government' ? 'user-verified-gray' : t.quoted_status.user.verified_type === 'Business' ? 'user-verified-yellow' : t.quoted_status.user.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(t.quoted_status.user.name)}</b>
<b class="tweet-header-name-quote ${t.quoted_status.user.verified ? 'user-verified' : t.quoted_status.user.id_str === '1708130407663759360' ? 'user-verified user-verified-dimden' : ''} ${t.quoted_status.user.protected ? 'user-protected' : ''} ${t.quoted_status.user.verified_type === 'Government' ? 'user-verified-gray' : t.quoted_status.user.verified_type === 'Business' ? 'user-verified-yellow' : t.quoted_status.user.verified_type === 'Blue' ? 'user-verified-blue' : ''}">${escapeHTML(t.quoted_status.user.name)}</b>
<span class="tweet-header-handle-quote">@${t.quoted_status.user.screen_name}</span>
</span>
</div>
Expand Down
Loading

0 comments on commit 9ae098c

Please sign in to comment.