From f93d22d29b177e0e6e2b011c8d73ae99e1f1d185 Mon Sep 17 00:00:00 2001 From: shenyutao Date: Wed, 13 Mar 2024 17:14:35 +0800 Subject: [PATCH] update --- src/hooks.ts | 2 +- src/modules/Common.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/hooks.ts b/src/hooks.ts index 78ffd9e..0f6d741 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -30,7 +30,7 @@ async function onMainWindowLoad(win: Window): Promise { UIFactory.registerRightClickMenuItem(); UIFactory.registerRightClickCollectionMenuItem(); - + UIFactory.registerTLDRItemBoxRow(); onLoad(); diff --git a/src/modules/Common.ts b/src/modules/Common.ts index 7fa95a9..b8b6207 100644 --- a/src/modules/Common.ts +++ b/src/modules/Common.ts @@ -71,7 +71,6 @@ export class UIFactory { }); } - // tldr行 static async registerTLDRItemBoxRow() { await ztoolkit.ItemBox.register( @@ -80,20 +79,17 @@ export class UIFactory { (field, unformatted, includeBaseMapped, item, original) => { const noteKey = tldrs.get()[item.key]; if (noteKey) { - const obj = Zotero.Items.getByLibraryAndKey( - item.libraryID, - noteKey, - ); + const obj = Zotero.Items.getByLibraryAndKey(item.libraryID, noteKey); if ( obj && obj instanceof Zotero.Item && item.getNotes().includes(obj.id) ) { let str = obj.getNote(); - if (str.startsWith('

TL;DR

\n

')) { - str = str.slice('

TL;DR

\n

'.length); + if (str.startsWith("

TL;DR

\n

")) { + str = str.slice("

TL;DR

\n

".length); } - if (str.endsWith('

')) { + if (str.endsWith("

")) { str = str.slice(0, -4); } return str; @@ -118,5 +114,4 @@ export class UIFactory { }, ); } - }