From f006995676fc2bc160cc6a05e3d46f8666b33c22 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 12 Jan 2023 20:22:18 -0500 Subject: [PATCH] Item box: Use addEventListener() --- chrome/content/zotero/bindings/itembox.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index be9af33a05..d9c7155384 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -423,7 +423,7 @@ && Zotero.Utilities.isHTTPURL(val, true)) { label.classList.add("pointer"); // TODO: make getFieldValue non-private and use below instead - label.setAttribute("onclick", "Zotero.launchURL(this.nextSibling.firstChild ? this.nextSibling.firstChild.nodeValue : this.nextSibling.value)"); + label.addEventListener('click', () => Zotero.launchURL(label.nextSibling.firstChild ? label.nextSibling.firstChild.nodeValue : label.nextSibling.value)); label.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); } else if (fieldName == 'DOI' && val && typeof val == 'string') { @@ -438,17 +438,17 @@ .replace(/%/g, '%25') .replace(/"/g, '%22'); label.classList.add("pointer"); - label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); + label.addEventListener('click', event => ZoteroPane_Local.loadURI(doi, event)); label.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); valueElement.oncontextmenu = () => { this._id('zotero-doi-menu').openPopup(valueElement); }; var openURLMenuItem = this._id('zotero-doi-menu-view-online'); - openURLMenuItem.setAttribute("oncommand", "ZoteroPane_Local.loadURI('" + doi + "', event)"); + openURLMenuItem.addEventListener('command', event => ZoteroPane_Local.loadURI(doi, event)); var copyMenuItem = this._id('zotero-doi-menu-copy'); - copyMenuItem.setAttribute("oncommand", "Zotero.Utilities.Internal.copyTextToClipboard('" + doi + "')"); + copyMenuItem.addEventListener('command', () => Zotero.Utilities.Internal.copyTextToClipboard(doi)); } } else if (fieldName == 'abstractNote') {