Skip to content

Commit 28c2034

Browse files
committed
if company tags set to false in local storage, remove the element if found on page
1 parent 32660e5 commit 28c2034

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/content-script/update-description.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
chrome.runtime.onMessage.addListener((request) => {
22
if (request.action === 'updateDescription') {
3+
4+
// testing some stuff
5+
6+
let descriptionContainer = document.querySelectorAll('div.px-5.pt-4')
7+
console.log(descriptionContainer)
8+
// end testing
9+
10+
311
chrome.storage.local.get(['hideTags'], (result) => {
412
let canShowCompanyTags = true;
513
canShowCompanyTags = !result.hideTags;
614
if (canShowCompanyTags) {
715
const title = request.title.split('-')[0].trim();
816
addCompanyTags(title);
917
}
18+
else {
19+
let buttonContainer = document.getElementById('companyButtonContainer');
20+
if (buttonContainer) {
21+
buttonContainer.remove();
22+
}
23+
}
1024
});
1125

1226
const details = document.querySelectorAll('div.mt-3.flex.space-x-4')[0];

src/popup/settings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ fontSizeSelect!.onchange = function () {
2626
};
2727

2828
document.getElementById('hide-tags-btn')!.addEventListener('click', function () {
29-
chrome.runtime.sendMessage({ message: 'updateDescription' })
3029
chrome.storage.local.get(['hideTags'], (result) => {
3130
const newHideTags = !result.hideTags;
3231
chrome.storage.local.set({ hideTags: newHideTags }, () => {
3332
document.getElementById('toggle-show-tags-text')!.textContent = newHideTags ? '❌' : '✅';
33+
34+
// Manually trigger the update description after toggling 'hideTags'
35+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
36+
chrome.tabs.sendMessage(tabs[0].id!, { action: 'updateDescription', title: tabs[0].title || 'title' });
37+
});
3438
});
3539
});
3640
});

0 commit comments

Comments
 (0)