diff options
| -rw-r--r-- | components/quotetable.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/components/quotetable.py b/components/quotetable.py index e85c335..e975a67 100644 --- a/components/quotetable.py +++ b/components/quotetable.py @@ -64,7 +64,7 @@ def render_quotetable(watchlist: list[str]) -> None: vol_str = "—" rows_html += ( - "<tr class='qt-row' onclick='selectQtTicker(\"" + sym_e + "\")'>" + "<tr class='qt-row' data-sym='" + sym_e + "'>" "<td class='lbl'>" + sym_e + "</td>" "<td class='sec'>" + sector_e + "</td>" "<td class='r'>" + px_str + "</td>" @@ -76,7 +76,7 @@ def render_quotetable(watchlist: list[str]) -> None: except Exception: sym_e = escape_html(sym) rows_html += ( - "<tr class='qt-row' onclick='selectQtTicker(\"" + sym_e + "\")'>" + "<tr class='qt-row' data-sym='" + sym_e + "'>" "<td class='lbl'>" + sym_e + "</td>" "<td class='sec'>—</td>" "<td class='r'>—</td>" @@ -148,7 +148,10 @@ def render_quotetable(watchlist: list[str]) -> None: "</table>" "</div>" "<script>" - "function selectQtTicker(sym) {" + "document.addEventListener('click', function(e) {" + " var row = e.target.closest('tr[data-sym]');" + " if (!row) return;" + " var sym = row.dataset.sym;" " try {" " var inputs = window.parent.document.querySelectorAll('input[type=text]');" " var target = null;" @@ -162,7 +165,7 @@ def render_quotetable(watchlist: list[str]) -> None: " setter.call(target, sym);" " target.dispatchEvent(new window.parent.Event('input', { bubbles: true }));" " } catch(e) { console.warn('quotetable click failed', e); }" - "}" + "});" "</script>" ) |
