mirror of
https://github.com/obsqrbtz/goose-highlighter.git
synced 2026-04-09 12:37:48 +03:00
fix: excame html in popup.js
This commit is contained in:
@@ -12,6 +12,18 @@ let saveTimeout;
|
|||||||
let selectedCheckboxes = new Set();
|
let selectedCheckboxes = new Set();
|
||||||
let globalHighlightEnabled = true;
|
let globalHighlightEnabled = true;
|
||||||
|
|
||||||
|
function escapeHtml(str) {
|
||||||
|
return str.replace(/[&<>"']/g, function (m) {
|
||||||
|
return ({
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": '''
|
||||||
|
})[m];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function debouncedSave() {
|
async function debouncedSave() {
|
||||||
clearTimeout(saveTimeout);
|
clearTimeout(saveTimeout);
|
||||||
saveTimeout = setTimeout(async () => {
|
saveTimeout = setTimeout(async () => {
|
||||||
@@ -79,7 +91,9 @@ async function load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderLists() {
|
function renderLists() {
|
||||||
listSelect.innerHTML = lists.map((list, index) => `<option value="${index}">${list.name}</option>`).join("");
|
listSelect.innerHTML = lists.map((list, index) =>
|
||||||
|
`<option value="${index}">${escapeHtml(list.name)}</option>`
|
||||||
|
).join("");
|
||||||
listSelect.value = currentListIndex;
|
listSelect.value = currentListIndex;
|
||||||
updateListForm();
|
updateListForm();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user