Tidy turbo long lines for scroll-less readability

This commit is contained in:
Zedifus 2022-10-22 18:50:48 +01:00
parent fd906d56e8
commit eaf5ae3664

View File

@ -114,10 +114,8 @@
console.log("ready!");
get_server_log();
populateWords();
});
function scroll() {
var logview = $('#virt_console');
if (logview.length)
@ -177,30 +175,39 @@
return;
}
// Display filtered word
words.push(word);
$("#ignored-words").append("<li id=" + safe_word.replaceAll(" ", "-") + "><div class='card-header header-sm d-flex justify-content-between align-items-center'>" + word + "&nbsp;<button class='btn btn-danger' onclick='deleteItem(" + '"' + word + '"' + ")' ><i class='fas fa-trash'></i></button></div></li>")
$("#ignored-words").append(
`<li id=${safe_word.replaceAll(" ", "-")}>` +
"<div class='card-header header-sm d-flex justify-content-between align-items-center'>" +
`${word}&nbsp;<button class='btn btn-danger' onclick='deleteItem("${word}")' >` +
"<i class='fas fa-trash'></i></button></div></li>"
);
// Set word filters in browser cache
localStorage.setItem("words", JSON.stringify(words))
localStorage.setItem("words", JSON.stringify(words));
});
function deleteItem(item) {
let safe_item = sanitize(item);
words.splice(words.indexOf(item), 1);
if (safe_item) {
$("#" + safe_item.replaceAll(" ", "-")).remove();
}
if (safe_item) $("#" + safe_item.replaceAll(" ", "-")).remove();
liveSearch();
localStorage.setItem("words", JSON.stringify(words))
localStorage.setItem("words", JSON.stringify(words));
}
function populateWords() {
for (let i = 0; i < words.length; i++) {
let safe_word = sanitize(words[i]);
$("#ignored-words").append("<li id=" + safe_word.replaceAll(" ", "-") + "><div class='card-header header-sm d-flex justify-content-between align-items-center'>" + words[i] + "&nbsp;<button class='btn btn-danger' onclick='deleteItem(" + '"' + words[i] + '"' + ")' ><i class='fas fa-trash'></i></button></div></li > ")
$("#ignored-words").append(
`<li id=${safe_word.replaceAll(" ", "-")}>` +
"<div class='card-header header-sm d-flex justify-content-between align-items-center'>" +
`${word}&nbsp;<button class='btn btn-danger' onclick='deleteItem("${word}")' >` +
"<i class='fas fa-trash'></i></button></div></li>"
);
}
}
</script>
{% end %}