@@ -15,7 +15,6 @@ import { it } from "node:test";
1515import * as ParseChapter from "./parsechapter"
1616import { openAsBlob } from "node:fs" ;
1717import * as Typography from "./typgraphy"
18- import { first } from "cheerio/lib/api/traversing" ;
1918
2019async function onStartup ( ) {
2120 await Promise . all ( [
@@ -92,11 +91,14 @@ function onAdd(id: number){
9291 ztoolkit . log ( "item added - id = " + id )
9392
9493 const attachment = Zotero . Items . get ( id )
95- const title = attachment . getDisplayTitle ( )
94+ const attachmentLink = attachment . getField ( "url" ) as string
9695
97- ztoolkit . log ( title )
9896
99- if ( title == "RI OPAC" ) {
97+
98+
99+ ztoolkit . log ( attachmentLink )
100+
101+ if ( attachmentLink . includes ( "/opac.regesta-imperii" ) ) {
100102 const chapterID = id - 1 // the chapter's id is one less than the attachment's id
101103 const item = Zotero . Items . get ( chapterID )
102104
@@ -105,7 +107,7 @@ function onAdd(id: number){
105107
106108 if ( item . itemType == "bookSection" ) {
107109 ztoolkit . log ( "chapter: " + item . getDisplayTitle ( ) )
108- processChapter ( item , attachment . getField ( "url" ) as string )
110+ processChapter ( item , attachmentLink )
109111 } else {
110112 ztoolkit . log ( "not a chapter" )
111113 if ( item . itemType == "book" ) {
0 commit comments