From 87f9173c2dd39f879107b1ff7b855cc46bbb3afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Mon, 29 Sep 2025 10:30:36 +0300 Subject: [PATCH] Citation Explorer: Uncited item display change --- .../zotero/integration/citationExplorer.js | 28 ++++----- .../zotero/integration/citationExplorer.xhtml | 11 +--- scss/components/_citationExplorer.scss | 61 ++++++------------- 3 files changed, 32 insertions(+), 68 deletions(-) diff --git a/chrome/content/zotero/integration/citationExplorer.js b/chrome/content/zotero/integration/citationExplorer.js index 2e564a54b1..8d33861f0b 100644 --- a/chrome/content/zotero/integration/citationExplorer.js +++ b/chrome/content/zotero/integration/citationExplorer.js @@ -194,6 +194,7 @@ window.ZoteroDocumentCitations = { onActivate: this.onItemActivate.bind(this), emptyMessage: Zotero.getString('pane.items.loading'), firstColumnExtraWidth: 28-16, + firstColumnPrependRenderer: this._itemFirstColumnPrependRenderer.bind(this), }); await itemList.waitForLoad(); // Remove focus from citationList if focus is on itemList @@ -236,19 +237,6 @@ window.ZoteroDocumentCitations = { await this.refreshItemList(); }, - onSelectTab: async function (selectedIndex) { - if (selectedIndex === selectedTab) return; - selectedTab = selectedIndex; - if (selectedTab) { - this._highlightedCitations = new Set(); - document.querySelector('#button-show-in-zotero').hidden = true; - document.querySelector('#button-relink-item').hidden = false; - document.querySelector('#button-addTo-library').style.display = 'none'; - } - await this.refreshCitationList(); - await this.refreshItemList(); - }, - _initMappings: async function () { const itemMap = {}; itemRows = items.map((item) => { @@ -267,7 +255,7 @@ window.ZoteroDocumentCitations = { itemMap[item.id || item.cslItemID] = proxyItem; return proxyItem; }); - uncitedItemRows = uncitedItems.map((item) => { + itemRows.push(...uncitedItems.map((item) => { return new Proxy(item, { get(target, prop) { if (prop == 'citedIn') { @@ -276,7 +264,7 @@ window.ZoteroDocumentCitations = { return Reflect.get(...arguments); } }); - }); + })); citationRows = await Promise.all(citations .map(async (citation, citationIndex) => { let isLinked = true; @@ -420,6 +408,16 @@ window.ZoteroDocumentCitations = { await this.refreshCitationList(); await this.refreshItemList(); }, + + _itemFirstColumnPrependRenderer: function (index, data, firstColumnPrepend) { + if (itemRows[index].citedIn.length === 0) { + let span = document.createElement('span'); + span.classList.add('badge', 'badge-uncited'); + span.textContent = 'Uncited'; + firstColumnPrepend.push(span); + } + return firstColumnPrepend; + }, async addToLibraryAndLink() { var collectionID = _addToTarget.objectType == 'collection' ? _addToTarget.id : undefined; diff --git a/chrome/content/zotero/integration/citationExplorer.xhtml b/chrome/content/zotero/integration/citationExplorer.xhtml index d49f54810c..5f9d7d8db0 100644 --- a/chrome/content/zotero/integration/citationExplorer.xhtml +++ b/chrome/content/zotero/integration/citationExplorer.xhtml @@ -84,16 +84,7 @@ -
- - - - - - - - -
+
Items in Bibliography
diff --git a/scss/components/_citationExplorer.scss b/scss/components/_citationExplorer.scss index 2b2bb89655..8bc2f61ae0 100644 --- a/scss/components/_citationExplorer.scss +++ b/scss/components/_citationExplorer.scss @@ -32,16 +32,11 @@ } } - .tabbox-container, #citations-label { + #citations-label, #items-in-bibliography-label { padding-top: 16px !important; - } - - #citations-label { align-content: center; - } - - .tabbox-container { - display: flex; + font-size: 15px; + font-weight: 600; } .virtualized-table-container { @@ -63,6 +58,21 @@ background: initial !important; } + .virtualized-table .row { + .cell .badge { + font-size: 11px; + padding: 1px 4px; + border-radius: 5px; + display: inline-block; + background: #59ADC44D; + } + + &.selected .cell .badge { + background: rgba(255, 255, 255, 0.2); + color: --var(accent-white); + } + } + .button-container { border-bottom: var(--material-border-quarternary); display: flex; @@ -86,40 +96,5 @@ padding-bottom: 0px; margin-bottom: -16px; } - - tabbox { - flex: 1; - flex-direction: row; - - tabs { - flex: 1; - margin-bottom: 0; - - tab { - flex: 1; - - &[visuallyselected="true"]:not(:-moz-window-inactive) { - color: initial !important; - } - label.tab-text { - flex-direction: column; - align-items: center; - } - } - - spacer.tabs-right { - flex: 0; - } - } - } - } - - @media (-moz-platform: windows) { - tabbox tabs { - border-bottom: none; - tab { - margin-bottom: 0; - } - } } }