fx-compat: Use html-tooltip everywhere

And convert tooltiptext attributes on item box HTML elements to titles.
This commit is contained in:
Abe Jellinek 2022-08-01 15:02:42 -04:00
parent 812511e31b
commit d018133e9b
2 changed files with 8 additions and 7 deletions

View file

@ -562,7 +562,7 @@
th.classList.add("pointer"); th.classList.add("pointer");
// TODO: make getFieldValue non-private and use below instead // TODO: make getFieldValue non-private and use below instead
th.addEventListener('click', () => Zotero.launchURL(th.nextSibling.firstChild.value || th.nextSibling.firstChild.textContent)); th.addEventListener('click', () => Zotero.launchURL(th.nextSibling.firstChild.value || th.nextSibling.firstChild.textContent));
th.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); th.setAttribute('title', Zotero.getString('pane.item.viewOnline.tooltip'));
} }
else if (fieldName == 'DOI' && val && typeof val == 'string') { else if (fieldName == 'DOI' && val && typeof val == 'string') {
// Pull out DOI, in case there's a prefix // Pull out DOI, in case there's a prefix
@ -577,7 +577,7 @@
.replace(/"/g, '%22'); .replace(/"/g, '%22');
th.classList.add("pointer"); th.classList.add("pointer");
th.addEventListener('click', event => ZoteroPane_Local.loadURI(doi, event)); th.addEventListener('click', event => ZoteroPane_Local.loadURI(doi, event));
th.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); th.setAttribute('title', Zotero.getString('pane.item.viewOnline.tooltip'));
valueElement.oncontextmenu = (event) => { valueElement.oncontextmenu = (event) => {
this._id('zotero-doi-menu').openPopupAtScreen( this._id('zotero-doi-menu').openPopupAtScreen(
event.screenX + 1, event.screenX + 1,
@ -1043,7 +1043,7 @@
// Switch to single-field mode // Switch to single-field mode
if (fieldMode == 1) { if (fieldMode == 1) {
button.style.background = `url("chrome://zotero/skin/textfield-dual${Zotero.hiDPISuffix}.png") center/21px auto no-repeat`; button.style.background = `url("chrome://zotero/skin/textfield-dual${Zotero.hiDPISuffix}.png") center/21px auto no-repeat`;
button.setAttribute('tooltiptext', Zotero.getString('pane.item.switchFieldMode.two')); button.setAttribute('title', Zotero.getString('pane.item.switchFieldMode.two'));
lastName.setAttribute('fieldMode', '1'); lastName.setAttribute('fieldMode', '1');
button.setAttribute('onclick', "this.getRootNode().host.switchCreatorMode(this.closest('tr'), 0, false, true)"); button.setAttribute('onclick', "this.getRootNode().host.switchCreatorMode(this.closest('tr'), 0, false, true)");
lastName.setAttribute('flex', '1'); lastName.setAttribute('flex', '1');
@ -1083,7 +1083,7 @@
// Switch to two-field mode // Switch to two-field mode
else { else {
button.style.background = `url("chrome://zotero/skin/textfield-single${Zotero.hiDPISuffix}.png") center/21px auto no-repeat`; button.style.background = `url("chrome://zotero/skin/textfield-single${Zotero.hiDPISuffix}.png") center/21px auto no-repeat`;
button.setAttribute('tooltiptext', Zotero.getString('pane.item.switchFieldMode.one')); button.setAttribute('title', Zotero.getString('pane.item.switchFieldMode.one'));
lastName.setAttribute('fieldMode', '0'); lastName.setAttribute('fieldMode', '0');
button.setAttribute('onclick', "this.getRootNode().host.switchCreatorMode(this.closest('tr'), 1, false, true)"); button.setAttribute('onclick', "this.getRootNode().host.switchCreatorMode(this.closest('tr'), 1, false, true)");
lastName.setAttribute('flex', '0'); lastName.setAttribute('flex', '0');
@ -1403,7 +1403,7 @@
// Display the SQL date as a tooltip for date fields // Display the SQL date as a tooltip for date fields
// TEMP - filingDate // TEMP - filingDate
if (Zotero.ItemFields.isFieldOfBase(fieldID, 'date') || fieldName == 'filingDate') { if (Zotero.ItemFields.isFieldOfBase(fieldID, 'date') || fieldName == 'filingDate') {
valueElement.setAttribute('tooltiptext', valueElement.setAttribute('title',
Zotero.Date.multipartToSQL(this.item.getField(fieldName, true))); Zotero.Date.multipartToSQL(this.item.getField(fieldName, true)));
} }

View file

@ -52,7 +52,8 @@
width="1000" height="600" width="1000" height="600"
persist="screenX screenY width height sizemode" persist="screenX screenY width height sizemode"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"
style="display: flex;"> style="display: flex;"
tooltip="html-tooltip">
<html:link rel="localization" href="branding/brand.ftl"/> <html:link rel="localization" href="branding/brand.ftl"/>
@ -844,7 +845,7 @@
oncommand="ZoteroPane_Local.search()"/> oncommand="ZoteroPane_Local.search()"/>
</hbox> </hbox>
<hbox id="zotero-item-toolbar" flex="1" align="center" tooltip="html-tooltip"> <hbox id="zotero-item-toolbar" flex="1" align="center">
<hbox align="center" pack="start" flex="1"> <hbox align="center" pack="start" flex="1">
<toolbarbutton <toolbarbutton
is="menu-toolbarbutton" is="menu-toolbarbutton"