mirror of
https://github.com/obsqrbtz/goose-highlighter.git
synced 2026-04-08 20:19:06 +03:00
feat: add collapsible sections
This commit is contained in:
@@ -115,5 +115,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Möchten Sie wirklich alle Ausnahmen löschen?"
|
"message": "Möchten Sie wirklich alle Ausnahmen löschen?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Entfernen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Are you sure you want to clear all exceptions?"
|
"message": "Are you sure you want to clear all exceptions?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Remove"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "¿Estás seguro de que deseas limpiar todas las excepciones?"
|
"message": "¿Estás seguro de que deseas limpiar todas las excepciones?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Eliminar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Êtes-vous sûr de vouloir effacer toutes les exceptions ?"
|
"message": "Êtes-vous sûr de vouloir effacer toutes les exceptions ?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Supprimer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "क्या आप वाकई सभी अपवादों को साफ करना चाहते हैं?"
|
"message": "क्या आप वाकई सभी अपवादों को साफ करना चाहते हैं?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "हटाएं"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Sei sicuro di voler cancellare tutte le eccezioni?"
|
"message": "Sei sicuro di voler cancellare tutte le eccezioni?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Rimuovi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "すべての例外をクリアしてもよろしいですか?"
|
"message": "すべての例外をクリアしてもよろしいですか?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "削除"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "모든 예외를 지우시겠습니까?"
|
"message": "모든 예외를 지우시겠습니까?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "제거"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Weet je zeker dat je alle uitzonderingen wilt wissen?"
|
"message": "Weet je zeker dat je alle uitzonderingen wilt wissen?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Verwijderen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Czy na pewno chcesz wyczyścić wszystkie wyjątki?"
|
"message": "Czy na pewno chcesz wyczyścić wszystkie wyjątki?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Usuń"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,5 +115,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Tem certeza de que deseja limpar todas as exceções?"
|
"message": "Tem certeza de que deseja limpar todas as exceções?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Remover"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Вы уверены, что хотите очистить все исключения?"
|
"message": "Вы уверены, что хотите очистить все исключения?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Удалить"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "Tüm istisnaları temizlemek istediğinizden emin misiniz?"
|
"message": "Tüm istisnaları temizlemek istediğinizden emin misiniz?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Kaldır"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,5 +121,8 @@
|
|||||||
},
|
},
|
||||||
"confirm_clear_exceptions": {
|
"confirm_clear_exceptions": {
|
||||||
"message": "您确定要清除所有例外吗?"
|
"message": "您确定要清除所有例外吗?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "移除"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,6 +80,7 @@ h1 {
|
|||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
@@ -87,6 +88,60 @@ h1 {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header:hover {
|
||||||
|
background: var(--highlight-tag);
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle {
|
||||||
|
background: none !important;
|
||||||
|
border: none !important;
|
||||||
|
color: var(--text-color) !important;
|
||||||
|
padding: 4px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle:hover {
|
||||||
|
background: var(--button-hover) !important;
|
||||||
|
color: var(--accent) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle i {
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .collapse-toggle i {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-content {
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 2000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .section-content {
|
||||||
|
max-height: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .section-header {
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section h2 {
|
.section h2 {
|
||||||
@@ -96,6 +151,7 @@ h1 {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"],
|
input[type="text"],
|
||||||
|
|||||||
158
popup/popup.html
158
popup/popup.html
@@ -29,83 +29,121 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="exceptions">
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<h2><i class="fa-solid fa-ban"></i> <span data-i18n="site_exceptions">Site Exceptions</span></h2>
|
<h2><i class="fa-solid fa-ban"></i> <span data-i18n="site_exceptions">Site Exceptions</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="exceptions">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-row">
|
<div class="section-content" id="exceptions-content">
|
||||||
<button id="toggleExceptionBtn"><i class="fa-solid fa-ban"></i> <span id="exceptionBtnText" data-i18n="add_exception">Add to Exceptions</span></button>
|
<div class="button-row">
|
||||||
<button id="manageExceptionsBtn"><i class="fa-solid fa-list"></i> <span data-i18n="manage_exceptions">Manage</span></button>
|
<button id="toggleExceptionBtn"><i class="fa-solid fa-ban"></i> <span id="exceptionBtnText" data-i18n="add_exception">Add to Exceptions</span></button>
|
||||||
</div>
|
<button id="manageExceptionsBtn"><i class="fa-solid fa-list"></i> <span data-i18n="manage_exceptions">Manage</span></button>
|
||||||
<div id="exceptionsPanel" class="exceptions-panel" style="display: none;">
|
</div>
|
||||||
<h3 data-i18n="exceptions_list">Exception Sites:</h3>
|
<div id="exceptionsPanel" class="exceptions-panel" style="display: none;">
|
||||||
<div id="exceptionsList" class="exceptions-list"></div>
|
<h3 data-i18n="exceptions_list">Exception Sites:</h3>
|
||||||
<button id="clearExceptionsBtn" class="danger"><i class="fa-solid fa-trash"></i> <span data-i18n="clear_all">Clear All</span></button>
|
<div id="exceptionsList" class="exceptions-list"></div>
|
||||||
|
<button id="clearExceptionsBtn" class="danger"><i class="fa-solid fa-trash"></i> <span data-i18n="clear_all">Clear All</span></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="lists">
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<h2><i class="fa-solid fa-list"></i> <span data-i18n="highlight_lists">Highlight Lists</span></h2>
|
<h2><i class="fa-solid fa-list"></i> <span data-i18n="highlight_lists">Highlight Lists</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="lists">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<label for="listSelect" data-i18n="select_list">Select List:</label>
|
<div class="section-content" id="lists-content">
|
||||||
<select id="listSelect"></select>
|
<label for="listSelect" data-i18n="select_list">Select List:</label>
|
||||||
<div class="button-row">
|
<select id="listSelect"></select>
|
||||||
<button id="newListBtn"><i class="fa-solid fa-plus"></i> <span data-i18n="new_list">New</span></button>
|
<div class="button-row">
|
||||||
<button id="deleteListBtn" class="danger"><i class="fa-solid fa-trash"></i> <span
|
<button id="newListBtn"><i class="fa-solid fa-plus"></i> <span data-i18n="new_list">New</span></button>
|
||||||
data-i18n="delete_list">Delete</span></button>
|
<button id="deleteListBtn" class="danger"><i class="fa-solid fa-trash"></i> <span
|
||||||
</div>
|
data-i18n="delete_list">Delete</span></button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
|
||||||
<h2><i class="fa-solid fa-gear"></i> <span data-i18n="list_settings">List Settings</span></h2>
|
|
||||||
<label><span data-i18n="list_name">List Name:</span> <input type="text" id="listName" /></label>
|
|
||||||
<div class="color-row">
|
|
||||||
<div class="color-label">
|
|
||||||
<span data-i18n="background">Background:</span>
|
|
||||||
<input type="color" id="listBg" />
|
|
||||||
</div>
|
|
||||||
<div class="color-label">
|
|
||||||
<span data-i18n="foreground">Foreground:</span>
|
|
||||||
<input type="color" id="listFg" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label>
|
|
||||||
<span data-i18n="enable_highlight">Enable Highlighting</span>
|
|
||||||
<input type="checkbox" class="switch" id="listActive" />
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="settings">
|
||||||
<h2><i class="fa-solid fa-pen"></i> <span data-i18n="add_words">Add Words</span></h2>
|
<div class="section-header">
|
||||||
<textarea id="bulkPaste" data-i18n="paste_hint" placeholder="Paste words here..."></textarea>
|
<h2><i class="fa-solid fa-gear"></i> <span data-i18n="list_settings">List Settings</span></h2>
|
||||||
<button id="addWordsBtn"><span data-i18n="apply_paste">Add Words</span></button>
|
<button class="collapse-toggle" data-target="settings">
|
||||||
</div>
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
<div class="section">
|
</div>
|
||||||
<h2><i class="fa-solid fa-tags"></i> <span data-i18n="word_list">Word List</span>(<span id="wordCount">0</span>)
|
<div class="section-content" id="settings-content">
|
||||||
</h2>
|
<label><span data-i18n="list_name">List Name:</span> <input type="text" id="listName" /></label>
|
||||||
<div class="button-row wrap">
|
<div class="color-row">
|
||||||
<button id="selectAllBtn"><span data-i18n="select_all">Select All</span></button>
|
<div class="color-label">
|
||||||
<button id="deselectAllBtn"><span data-i18n="deselect_all">Clear</span></button>
|
<span data-i18n="background">Background:</span>
|
||||||
<button id="enableSelectedBtn"><span data-i18n="enable_selected">Enable</span></button>
|
<input type="color" id="listBg" />
|
||||||
<button id="disableSelectedBtn"><span data-i18n="disable_selected">Disable</span></button>
|
</div>
|
||||||
<button id="deleteSelectedBtn" class="danger"><span data-i18n="delete_selected">Delete</span></button>
|
<div class="color-label">
|
||||||
|
<span data-i18n="foreground">Foreground:</span>
|
||||||
|
<input type="color" id="listFg" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label>
|
||||||
|
<span data-i18n="enable_highlight">Enable Highlighting</span>
|
||||||
|
<input type="checkbox" class="switch" id="listActive" />
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" id="wordSearch" data-i18n="search_placeholder" placeholder="Search..." />
|
|
||||||
<div id="wordList"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="addwords">
|
||||||
<h2><i class="fa-solid fa-sliders"></i> <span data-i18n="options">Options</span></h2>
|
<div class="section-header">
|
||||||
<div class="button-row" style="margin-bottom:8px;">
|
<h2><i class="fa-solid fa-pen"></i> <span data-i18n="add_words">Add Words</span></h2>
|
||||||
<label><input type="checkbox" id="matchCase" /> <span data-i18n="match_case">Match Case</span></label>
|
<button class="collapse-toggle" data-target="addwords">
|
||||||
<label><input type="checkbox" id="matchWhole" /> <span data-i18n="match_whole">Match Whole Word</span></label>
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-row">
|
<div class="section-content" id="addwords-content">
|
||||||
<button id="importBtn"><i class="fa-solid fa-upload"></i> <span data-i18n="import_list">Import</span></button>
|
<textarea id="bulkPaste" data-i18n="paste_hint" placeholder="Paste words here..."></textarea>
|
||||||
<input type="file" id="importInput" accept="application/json" hidden />
|
<button id="addWordsBtn"><span data-i18n="apply_paste">Add Words</span></button>
|
||||||
<button id="exportBtn"><i class="fa-solid fa-download"></i> <span data-i18n="export_list">Export</span></button>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section" data-section="wordlist">
|
||||||
|
<div class="section-header">
|
||||||
|
<h2><i class="fa-solid fa-tags"></i> <span data-i18n="word_list">Word List</span>(<span id="wordCount">0</span>)
|
||||||
|
</h2>
|
||||||
|
<button class="collapse-toggle" data-target="wordlist">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="section-content" id="wordlist-content">
|
||||||
|
<div class="button-row wrap">
|
||||||
|
<button id="selectAllBtn"><span data-i18n="select_all">Select All</span></button>
|
||||||
|
<button id="deselectAllBtn"><span data-i18n="deselect_all">Clear</span></button>
|
||||||
|
<button id="enableSelectedBtn"><span data-i18n="enable_selected">Enable</span></button>
|
||||||
|
<button id="disableSelectedBtn"><span data-i18n="disable_selected">Disable</span></button>
|
||||||
|
<button id="deleteSelectedBtn" class="danger"><span data-i18n="delete_selected">Delete</span></button>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="wordSearch" data-i18n="search_placeholder" placeholder="Search..." />
|
||||||
|
<div id="wordList"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section" data-section="options">
|
||||||
|
<div class="section-header">
|
||||||
|
<h2><i class="fa-solid fa-sliders"></i> <span data-i18n="options">Options</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="options">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="section-content" id="options-content">
|
||||||
|
<div class="button-row" style="margin-bottom:8px;">
|
||||||
|
<label><input type="checkbox" id="matchCase" /> <span data-i18n="match_case">Match Case</span></label>
|
||||||
|
<label><input type="checkbox" id="matchWhole" /> <span data-i18n="match_whole">Match Whole Word</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="button-row">
|
||||||
|
<button id="importBtn"><i class="fa-solid fa-upload"></i> <span data-i18n="import_list">Import</span></button>
|
||||||
|
<input type="file" id="importInput" accept="application/json" hidden />
|
||||||
|
<button id="exportBtn"><i class="fa-solid fa-download"></i> <span data-i18n="export_list">Export</span></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,6 +17,51 @@ let matchCaseEnabled = false;
|
|||||||
let matchWholeEnabled = false;
|
let matchWholeEnabled = false;
|
||||||
let exceptionsList = [];
|
let exceptionsList = [];
|
||||||
let currentTabHost = '';
|
let currentTabHost = '';
|
||||||
|
let sectionStates = {};
|
||||||
|
|
||||||
|
function loadSectionStates() {
|
||||||
|
const saved = localStorage.getItem('goose-highlighter-section-states');
|
||||||
|
if (saved) {
|
||||||
|
try {
|
||||||
|
sectionStates = JSON.parse(saved);
|
||||||
|
} catch {
|
||||||
|
sectionStates = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSectionStates() {
|
||||||
|
localStorage.setItem('goose-highlighter-section-states', JSON.stringify(sectionStates));
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleSection(sectionName) {
|
||||||
|
const section = document.querySelector(`[data-section="${sectionName}"]`);
|
||||||
|
if (!section) return;
|
||||||
|
|
||||||
|
const isCollapsed = section.classList.contains('collapsed');
|
||||||
|
|
||||||
|
if (isCollapsed) {
|
||||||
|
section.classList.remove('collapsed');
|
||||||
|
sectionStates[sectionName] = false;
|
||||||
|
} else {
|
||||||
|
section.classList.add('collapsed');
|
||||||
|
sectionStates[sectionName] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSectionStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeSectionStates() {
|
||||||
|
loadSectionStates();
|
||||||
|
|
||||||
|
// Apply saved states
|
||||||
|
Object.keys(sectionStates).forEach(sectionName => {
|
||||||
|
const section = document.querySelector(`[data-section="${sectionName}"]`);
|
||||||
|
if (section && sectionStates[sectionName]) {
|
||||||
|
section.classList.add('collapsed');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
return str.replace(/[&<>"']/g, function (m) {
|
return str.replace(/[&<>"']/g, function (m) {
|
||||||
@@ -278,13 +323,39 @@ function renderExceptions() {
|
|||||||
container.innerHTML = exceptionsList.map(domain =>
|
container.innerHTML = exceptionsList.map(domain =>
|
||||||
`<div class="exception-item">
|
`<div class="exception-item">
|
||||||
<span class="exception-domain">${escapeHtml(domain)}</span>
|
<span class="exception-domain">${escapeHtml(domain)}</span>
|
||||||
<button class="exception-remove" data-domain="${escapeHtml(domain)}">Remove</button>
|
<button class="exception-remove" data-domain="${escapeHtml(domain)}">${chrome.i18n.getMessage('remove')}</button>
|
||||||
</div>`
|
</div>`
|
||||||
).join('');
|
).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
initializeSectionStates();
|
||||||
localizePage();
|
localizePage();
|
||||||
|
|
||||||
|
// Add event listeners for collapse toggles
|
||||||
|
document.querySelectorAll('.collapse-toggle').forEach(button => {
|
||||||
|
button.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
const targetSection = button.getAttribute('data-target');
|
||||||
|
toggleSection(targetSection);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Also allow clicking section headers to toggle
|
||||||
|
document.querySelectorAll('.section-header').forEach(header => {
|
||||||
|
header.addEventListener('click', (e) => {
|
||||||
|
// Don't toggle if clicking on a button or input within the header
|
||||||
|
if (e.target.tagName === 'BUTTON' || e.target.tagName === 'INPUT' || e.target.closest('button')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const section = header.closest('.section');
|
||||||
|
const sectionName = section.getAttribute('data-section');
|
||||||
|
if (sectionName) {
|
||||||
|
toggleSection(sectionName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.getElementById('selectAllBtn').onclick = () => {
|
document.getElementById('selectAllBtn').onclick = () => {
|
||||||
const list = lists[currentListIndex];
|
const list = lists[currentListIndex];
|
||||||
list.words.forEach((_, index) => {
|
list.words.forEach((_, index) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user