diff options
| -rw-r--r-- | Info/9/3/Planet/templates/add-glossary-item.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Info/9/3/Planet/templates/add-glossary-item.js b/Info/9/3/Planet/templates/add-glossary-item.js index dd5d5cf5..f2f32b38 100644 --- a/Info/9/3/Planet/templates/add-glossary-item.js +++ b/Info/9/3/Planet/templates/add-glossary-item.js @@ -10,9 +10,8 @@ const glossaryId = (/id=(\d+)/).exec(glossaryUrl)[1]; activityLinkNode.remove(); class GlossaryPost { - constructor(eid, showurl, concept) { + constructor(eid, concept) { this.eid = eid; - this.showurl = showurl; this.concept = concept; } } @@ -21,7 +20,7 @@ function autoLinkHTML(post) { const a = document.createElement("a"); a.classList.add("glossary", "autolink", "concept", `glossaryid${post.eid}`); a.dataset.entryid=post.eid; - a.href = post.showurl; + a.href = `/mod/glossary/showentry.php?eid=${post.eid}&displayformat=dictionary`; a.innerHTML = post.concept; return a.outerHTML; } @@ -53,10 +52,10 @@ async function autoLink() { glDoc.querySelectorAll(".glossarypost.dictionary").forEach((post) => { const concept = post.querySelector(".entry > .concept").innerText; - const showurl = post.querySelector('.commands > a.icon[title*="Eingabelink"]').href; - const eid = (/eid=(\d+)/).exec(showurl)[1]; + const editurl = post.querySelector('.commands > a.icon[title*="Bearbeiten"]').href; + const eid = (/&id=(\d+)/).exec(editurl)[1]; - termsAlreadyAdded.set(concept, new GlossaryPost(eid, showurl, concept)); + termsAlreadyAdded.set(concept, new GlossaryPost(eid, concept)); }); const page = document.querySelector('div[role="main"]'); @@ -102,8 +101,7 @@ async function addGlossaryItems() { item.classList.remove("glossary-item-toadd"); const eid = (/hook=(\d+)/).exec(showAddedPostUrl)[1]; - const showurl = `/mod/glossary/showentry.php?eid=${eid}&displayformat=dictionary`; - const post = new GlossaryPost(eid, showurl, item.dataset.term) + const post = new GlossaryPost(eid, item.dataset.term) item.innerHTML = autoLinkHTML(post); // Link to all occurrences of the added term |
