mirror of
https://gitlab.aachen.ccc.de/inventory/in.git
synced 2024-11-25 16:53:59 +01:00
add prefix to item id when using as html id
prevents accidental re-use of html ids
This commit is contained in:
parent
bde640c6e3
commit
4bf4f754c9
1 changed files with 2 additions and 2 deletions
|
@ -28,7 +28,7 @@ function renderItems() {
|
||||||
clone.querySelector(".name").textContent = item.name;
|
clone.querySelector(".name").textContent = item.name;
|
||||||
clone.querySelector(".content").textContent = item.content;
|
clone.querySelector(".content").textContent = item.content;
|
||||||
clone.querySelector(".note").textContent = item.note;
|
clone.querySelector(".note").textContent = item.note;
|
||||||
clone.querySelector(".result").id = id;
|
clone.querySelector(".result").id = `item-${id}`;
|
||||||
clone.querySelector("a").href = `form.html?id=${id}`;
|
clone.querySelector("a").href = `form.html?id=${id}`;
|
||||||
if (item.hidden) {
|
if (item.hidden) {
|
||||||
clone.querySelector(".result").classList.add('hidden')
|
clone.querySelector(".result").classList.add('hidden')
|
||||||
|
@ -69,7 +69,7 @@ function search(e) {
|
||||||
const regex = new RegExp(query, 'i')
|
const regex = new RegExp(query, 'i')
|
||||||
|
|
||||||
for (const elem of document.getElementsByClassName('result')) {
|
for (const elem of document.getElementsByClassName('result')) {
|
||||||
const item = items[elem.id];
|
const item = items[elem.id.substr(5)];
|
||||||
let found = false;
|
let found = false;
|
||||||
if (query) {
|
if (query) {
|
||||||
for (const a in searchAttrs) {
|
for (const a in searchAttrs) {
|
||||||
|
|
Loading…
Reference in a new issue