From bf84d7797b1f6e74f95106ae7a44c1a6c9a1aaf6 Mon Sep 17 00:00:00 2001 From: Jeff Zohrab Date: Wed, 22 Jan 2025 15:45:20 -0600 Subject: [PATCH] Add reading menu link to show term list. --- lute/static/js/lute.js | 21 +++++++++++++++++++++ lute/templates/read/reading_menu.html | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/lute/static/js/lute.js b/lute/static/js/lute.js index 79fbff1cc..4691c1597 100644 --- a/lute/static/js/lute.js +++ b/lute/static/js/lute.js @@ -825,6 +825,27 @@ let show_translation_for_text = function(text) { }; +// Get all the word ids on the current page, open new tab with just those terms. +function open_term_list_for_current_page() { + const ids = new Set(); + $('span.word').each(function () { + ids.add($(this).data("wid")); + }); + if (ids.length == 0) + return; // Nothing to do. + + const idarray = Array.from(ids); + const idlist = idarray.join('+'); + + // console.log('passing ids:'); + // console.log(idlist); + // let msg = idlist; + // window.alert(msg); + const url = `/term/index?termids=${idlist}`; + window.open(url); +} + + /** Show the translation using the next dictionary. */ function handle_translate(span_attribute) { const tis = get_textitems_spans(span_attribute); diff --git a/lute/templates/read/reading_menu.html b/lute/templates/read/reading_menu.html index b24b545bc..064d4458b 100644 --- a/lute/templates/read/reading_menu.html +++ b/lute/templates/read/reading_menu.html @@ -91,6 +91,11 @@ +
  • + + Term list + +