Compare commits

...

1205 Commits

Author SHA1 Message Date
xenia b1c986427b remove this horrid crap 2025-12-07 19:04:06 -05:00
abaevbog 2e13e9407d
ACM Queue Translator (#3529) 2025-12-04 15:06:55 -05:00
Hassan Afjnik ffa1be434c Add translator for Ined (#2826) 2025-12-04 13:36:02 -05:00
abaevbog 2f7fc8eb9b
Le Monde: fix authors and sections not being fetched (#3522) 2025-12-04 13:25:18 -05:00
Abe Jellinek 7f632f76bc ScienceDirect: Work around port in canonical link
https://forums.zotero.org/discussion/128356/sciencedirect-fails-to-import-pdf
2025-12-02 13:01:59 -05:00
Abe Jellinek ee1746de4d arXiv: Don't pull PDF URL from <link>
The PDF link no longer has title="pdf".

https://forums.zotero.org/discussion/128019/zotero-cannot-fetch-pdfs-from-arxiv-anymore
2025-11-12 10:43:13 -05:00
Abe Jellinek 36745ead6d PMC: Fix mismatched metadata when saving multiples
The API can return metadata out of order.

https://forums.zotero.org/discussion/127910/pubmed-central-issue-wrong-url-pmcid-information-wrong-catalog-page-and-article
2025-11-06 15:34:41 -05:00
Abe Jellinek 4fe143f5d0 The Met: Update for site changes, use API
https://forums.zotero.org/discussion/127908/unable-to-save-with-items-in-firefox-or-safari
2025-11-06 11:00:35 -05:00
Abe Jellinek 6365ccdf13 CI: Fix translator tests
By switching from Selenium to Playwright. It's honestly unbelievable
that Selenium's JS library still doesn't support loading unpacked
extensions on recent Chrome versions. Playwright handles it easily, and
it has a nicer API overall.
2025-10-31 15:08:37 -04:00
Abe Jellinek b44a279901 CI: Log title and URL when test page fails to load 2025-10-31 13:40:29 -04:00
Abe Jellinek 7e1b981f92 CI: Wait longer for test page to load 2025-10-31 12:52:10 -04:00
Abe Jellinek a79e3bea38 EUR-Lex: Update for site changes
Language is no longer in the URL.

Fixes #3447
2025-10-30 11:52:09 -04:00
swifterslb 93af89a882
Add translator for FAOLEX Database (#3498)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-10-30 11:40:41 -04:00
Dandelion Good 20b8729b80
Add translator for Anarchist Library (#3499) 2025-10-28 16:06:45 -04:00
Abe Jellinek 303ca7d64d OSF Preprints: Rewrite after site changes
We're only targeting osf.io now. Most other sites have been merged (and
redirected) into osf.io, and the few that haven't appear to be using
other software.

Fixes #3512
2025-10-28 10:53:31 -04:00
Abe Jellinek 59967fbfab
Add translator for Google Gemini (#3509) 2025-10-27 11:56:35 -04:00
Abe Jellinek d7d7426860 ChatGPT: Grab share URL when available
When saving a private conversation, enumerate shares and see if we have
one that matches and is up to date.
2025-10-27 11:39:28 -04:00
Abe Jellinek 7d12fd8f2d
Add translator for ChatGPT (#3507) 2025-10-27 11:14:21 -04:00
vanderwaalforces b56c554203
Prime 9ja Online: Exclude non-human authors, add Pidgin support (#3502)
And other miscellaneous tweaks.

Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-10-24 15:39:48 -04:00
Abe Jellinek bb41570843 Add AGENTS.md 2025-10-24 12:36:16 -04:00
Abe Jellinek 259ea55d73 HAL: Rename, update for current site
https://forums.zotero.org/discussion/127602/hal-translator-not-recognized
2025-10-23 13:04:13 -04:00
Jason Murphy ea900c2124
Papers Past: Enhanced metadata extraction for newspapers (#3497)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-10-21 12:36:32 -04:00
Alex T. 2eef9d03f9
ePrint: fix saving PostScript attachments (#3506) 2025-10-20 12:13:32 -04:00
swifterslb a095751f8a
FAO Publications → Knowledge Repository, rewrite for new site (#3504) 2025-10-16 12:06:41 -04:00
Ivo Pletikosić 352989d042
Add translator for Hrvatska enciklopedija (#3500) 2025-10-16 11:55:09 -04:00
Abe Jellinek 4ae717da83 EBSCO Locate: Get API base URL from JS
Instead of assuming based on the domain - that rule apparently doesn't
hold for all instances.

Fixes #3501
2025-10-16 11:04:31 -04:00
Corinna Baksik d0f2d15874
adding plural versions of some resource types for Primo XML (#3494) 2025-10-14 14:54:08 -04:00
Abe Jellinek df835b0e1d EM: Update tests for site changes 2025-10-14 13:30:03 -04:00
Abe Jellinek 8a9ef4a1de EM: Only extract a single canonical URL
Even when there are multiple <link rel="canonical">s. ZU.xpathText()
joins all matches, attr() uses the first match.
2025-10-14 13:28:44 -04:00
Pascal Quach 2da50c6a39
Embedded Metadata: deduplicate bylines when getting authors (#3493)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-10-14 13:24:33 -04:00
Abe Jellinek e9335d57c9 Toronto Star: Update for site changes
https://forums.zotero.org/discussion/127185/error-report-1509932172-toronto-star-translator-is-broken
2025-10-07 11:39:13 -04:00
Abe Jellinek 0855c33a6c WSJ: Update for site changes
https://forums.zotero.org/discussion/126893/wall-street-journal-not-recognized-as-a-newspaper
2025-10-07 09:31:49 -04:00
Abe Jellinek 085b8db857 InvenioRDM: Save DOIs on preprint items
And update tests.

DOIs disappeared from tests because the test runner doesn't currently
move unsupported fields to `extra`.

https://forums.zotero.org/discussion/126862/no-doi-or-pdf-saved-for-zenodo-preprint
2025-09-18 11:11:08 -04:00
Abe Jellinek 41f8149d88 PubMed Central: Update for site changes
- New domain
- New search page structure
- New, consistent URL for PDFs, so no need to trawl the XML for
  a filename
- Update attachment titles
- Update tests

Fixes #3491
2025-09-17 12:31:25 -04:00
Abe Jellinek f6d9cb90e5 ThesesFR: Get direct PDF link from page
https://forums.zotero.org/discussion/comment/499131/#Comment_499131
2025-09-11 11:44:29 -04:00
Abe Jellinek e343623dfe ThesesFR: Update for site changes, fix scraping URL with hash
https://forums.zotero.org/discussion/106637/broken-thesesfr-translator
2025-09-11 10:42:05 -04:00
Abe Jellinek c44f7f6489 Add translator for Ovid OCE
Fixes #3381
2025-09-03 12:42:55 -04:00
Abe Jellinek 52a114f843 LWN: Fix date selector
https://forums.zotero.org/discussion/126379/connector-not-importing-lwn-net-articles
2025-08-28 10:37:35 -04:00
Pascal Martinolli 727fd1cc63
Wikidata QuickStatements: Support more item types and permanent identifiers (#3468)
Co-authored-by: Alex T. <frozen.and.blue@gmail.com>
2025-08-28 10:28:08 -04:00
Sebastian Karcher f9ff5e2818
Add translator for EBSCO Locate catalogs (#3485)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-08-28 10:20:16 -04:00
Abe Jellinek d9f3bb8f77 PhilPapers: Exports are now auth-walled
So use the embedded BibTeX when it's there, and otherwise don't detect.

https://forums.zotero.org/discussion/126194/zotero-connector-for-philpapers-org-safari-on-mac
2025-08-19 11:22:24 -04:00
Abe Jellinek c30b7d743b WoS: Fix detection 2025-08-18 13:13:15 -04:00
Abe Jellinek ea61c7bc35 WoS: Update for site changes and improve cleaning
- Don't detect if unauthenticated
- Fix search QID extraction when URL contains two IDs
  (not sure what the second one is for)
- Don't detect multiples on single-item pages
- Get full metadata for patents
- Fix all-uppercase publication titles
- Don't try to resolve gateway for DOIs
- Update tests

https://forums.zotero.org/discussion/126134/errors-with-zotero-connector-and-web-of-science-next-gen
2025-08-18 13:10:56 -04:00
Abe Jellinek 83d1bae957 CI: Gripe about AI when translator is badly formatted
Instead of failing with a confusing error message ("TypeError: Cannot
read properties of null (reading '0')").
2025-08-15 15:49:52 -04:00
Abe Jellinek ff648a300c CI: Use a faster method to find dependent translators 2025-08-15 14:19:34 -04:00
Abe Jellinek 17b68b5ea4 CI: Use ES modules 2025-08-15 14:13:20 -04:00
vanderwaalforces 045d65428b
Add translator for Premium Times (#3460) 2025-08-14 12:54:46 -04:00
vanderwaalforces 063470ef1e
Add Prime 9ja Online (#3459) 2025-08-08 11:35:37 -06:00
Abe Jellinek ba32042c02 DOAJ: Get full abstract
https://forums.zotero.org/discussion/126000/zotero-connector-does-not-collect-full-abstract-from-doaj
2025-08-08 10:01:33 -06:00
Alex T. 04550f03ff
Fix Dagstuhl PDF saving (#3476) 2025-08-08 08:59:28 -06:00
Abe Jellinek fa5940aad8
RDF: Move issue to number (don't copy) if issue isn't valid (#3483) 2025-08-07 08:47:04 -06:00
Jennifer Chen a0de6dc471
Update NASA ADS translator to support new app scixplorer.org (#3479) 2025-08-06 07:19:14 -04:00
Abe Jellinek 746e8a71f0 MIT Press Books: Update for site changes
https://forums.zotero.org/discussion/125768/mit-press-books-translator-not-working
2025-08-05 16:50:45 -04:00
Dan Stillman fcab5e6679 Crossref REST: Fall back to article number if no page number
https://forums.zotero.org/discussion/comment/496681/#Comment_496681

Similar behavior in Crossref Unixref XML:

017fdf0f44/Crossref%20Unixref%20XML.js (L411-L420)
2025-08-03 01:39:59 -04:00
Abe Jellinek 70ee40d3e1 ProQuest: Fix saving from PDF tab
Element ID changed.

https://forums.zotero.org/discussion/125821/embedded-pdfs-do-not-download-with-find-full-text-feature
2025-07-31 13:15:27 -04:00
Andrew Dunning 4d2bfbd39d
IMDb: Improve CSL specification adherence (#3461)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-07-29 13:26:31 -04:00
timlst a12fe985be
Add USENIX translator (#3477) 2025-07-29 12:56:09 -04:00
Abe Jellinek e0398e97d2 Silverchair: Don't put full name in journal abbrev. field
And update tests, except for a couple that I keep getting rate-limited
on.

https://github.com/zotero/translators/issues/3394#issuecomment-2498657612

Closes #3394
2025-07-29 12:31:39 -04:00
Abe Jellinek 32b768595e
Scopus: Update for site changes (#3478) 2025-07-29 12:12:14 -04:00
Dan Stillman a1d40d2aa6 DOI Content Negotiation: Stop using REST API due to slow response times 2025-07-27 00:52:13 -04:00
Abe Jellinek c089bf10db CI: Fix failures due to Chrome removing --load-extension
We're apparently supposed to be using a new extension installation
function exposed by the "WebDriver BiDi" protocol, but Selenium's JS
binding doesn't support that yet.

So instead, we use a feature flag to un-remove --load-extension. That
workaround will eventually break, but hopefully by that point Selenium
will support BiDi extension installation.

BiDi installation issue: https://github.com/SeleniumHQ/selenium/issues/15585
Chrome announcement: https://groups.google.com/a/chromium.org/g/chromium-extensions/c/1-g8EFx2BBY/m/S0ET5wPjCAAJ
2025-07-25 12:15:58 -04:00
Abe Jellinek 38662755f4 mEDRA: Disable until fixed
zotero/zotero#5384, #3472
2025-07-14 13:56:11 -04:00
Abe Jellinek 8f3c5f73d0 eLife: Fix saving versioned article URLs
https://forums.zotero.org/discussion/comment/495162/#Comment_495162
2025-07-10 14:26:28 -04:00
Abe Jellinek 47bbe8f716 Open WorldCat: Use search.worldcat.org, remove Google Cache
May mitigate some issues like
https://forums.zotero.org/discussion/comment/495096/#Comment_495096.
That particular problem will probably still occur until the Wayback
Machine re-crawls WorldCat.
2025-07-09 15:24:10 -04:00
Abe Jellinek 3491570a60 beck-online: Add fallback URL
I'm not seeing a permalink anywhere anymore, but it's possible that it
doesn't show unless you're logged in? Either way, a fallback can't hurt.

https://forums.zotero.org/discussion/125262/problem-with-saving-snapshots-from-beck-online
zotero/zotero-connectors#554
2025-07-09 09:51:31 -04:00
Dan Stillman da3d32b5e3 DOI Content Negotiation: Always use REST API for Crossref DOIs for now 2025-07-07 01:56:48 -04:00
Abe Jellinek 6776c18568 Flickr: Fix saving JPEGs
Connector wants a valid MIME type.

https://forums.zotero.org/discussion/125083/inconsistant-photo-downloads-from-flickr-translator
2025-06-27 10:29:44 -04:00
Abe Jellinek 50113e5cf3 HeinOnline: Fix metadata issues after site changes
PDF downloads still seem to be broken.
2025-06-20 13:11:43 -04:00
Abe Jellinek 3e194622e7 Silverchair: Handle OUP book ToCs
- Add '[Full Book]' option (still need to localize these)
- Fix multiples titles including access info

https://forums.zotero.org/discussion/124835/problem-with-oup-academic-books
2025-06-13 10:38:46 -04:00
Abe Jellinek 3db53195f7 Nature Publishing Group: Update online-only publication logic
- Check for article number even if hardcoded list doesn't match
- Add more publications to list

https://forums.zotero.org/discussion/124450/wrong-pages-field-for-online-journals-with-nature-publishing-group-translator
https://forums.zotero.org/discussion/99725/zotero-connector-wrong-pages-for-communications-physics-journal

Fixes #3457
2025-06-12 12:23:18 -04:00
Abe Jellinek 29bf90b2e6 YouTube: Get description from #snippet
Fixes #3458
2025-06-12 12:10:37 -04:00
Abe Jellinek 45e839c3ef Wiley: Work around subdomain cookie issues
https://forums.zotero.org/discussion/124692/issue-with-saving-items-from-wires-climate-change
2025-06-11 11:32:31 -04:00
Abe Jellinek 0673614c60 EM: Get author from <a rel="author">
https://forums.zotero.org/discussion/124767/zotero-and-statista
2025-06-10 10:42:21 -04:00
Abe Jellinek 6a0659b90e CI: Fix get_translators_to_check() for push runs 2025-06-03 16:39:13 -04:00
Abe Jellinek 7224c4668d CI: Restore correct extension ID
https://github.com/zotero/translators/pull/3450#discussion_r2100442585
2025-06-03 16:11:42 -04:00
Abe Jellinek 9e4cae74d9 CI: Fix mistaken removal of JSON parsing dependency
Should fix linting.
2025-06-03 16:11:31 -04:00
Skye Im 66ab19e9e6
Library Catalog (TIND ILS): Improve detection (#3454) 2025-06-03 14:52:05 -04:00
Dan Stillman 1757ec73e0 DOI Content Negotiation: Update for current outage 2025-05-22 10:51:16 -04:00
Ilya Zonov 94e7ff02de
Add translator for Litres bookstore (#3430) 2025-05-21 10:39:10 -04:00
Abe Jellinek 19c8cc97d9 CI: Fail instead of timing out when tester page doesn't load 2025-05-21 10:35:56 -04:00
Ilya Zonov b4a6852cd1
Add translator for Habr (#3428) 2025-05-20 14:33:18 -04:00
Abe Jellinek 9ad46e744d
Fix CI (#3450) 2025-05-20 13:02:33 -04:00
Abe Jellinek d32bd3bb22 Primo 2018: Update target
New interface that will apparently have .urlToXmlPnx elements soon. We
can update tests when it's actually detectable.
2025-05-20 11:10:15 -04:00
morganfshirley 0b8f70904d
Added translator for CJTCS (#3445) 2025-05-20 10:56:54 -04:00
Dan Stillman c693a59fcd DOI Content Negotiation: Update for planned outage 2025-05-16 03:12:53 -04:00
Abe Jellinek d9a2688253 De Gruyter: Rename to De Gruyter Brill, update selector for issue page
Brill still has its own separate site, so no need to update that
translator.

https://forums.zotero.org/discussion/124219/zotero-connector-not-getting-pdfs-from-de-gruyter-brill
2025-05-13 09:36:49 -04:00
Abe Jellinek 9a7f28a04f EM: Detect some >2-particle Spanish family names
https://forums.zotero.org/discussion/comment/491943#Comment_491943
2025-05-09 14:26:02 -04:00
Abe Jellinek 54f4e65bf1 Delete Ab Imperio 2025-05-08 14:47:41 -04:00
Abe Jellinek 59a1de0470 Types: Fix monitorDOMChanges() signature 2025-05-08 13:56:22 -04:00
Abe Jellinek 207b7f72ee AEA Web: Add JEL codes when available 2025-05-08 13:43:23 -04:00
Abe Jellinek 6cff1f4c1d EM: Fix error when byline is non-HTML tag
And has no innerText.
2025-05-08 13:21:42 -04:00
Sharon Howard 3659936600
Update Old Bailey Online translator (#3357) 2025-05-08 12:42:03 -04:00
Bardi Harborow 4ef374389f
Add The Times of Israel (#3432)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-05-08 12:31:19 -04:00
Abe Jellinek 0bdc06b390 EM: Only abort on multiple bylines if different 2025-05-08 12:28:19 -04:00
Abe Jellinek 889e905800 EM: Remove bad tests, update old ones, add a new one
Not sure what happened to UMass ScholarWorks - metadata isn't very
complete anymore.

And bump lastUpdated.
2025-05-08 12:23:26 -04:00
Abe Jellinek 75352d087e EM: Remove more irrelevant byline children 2025-05-08 12:23:26 -04:00
Abe Jellinek d7a64e5842 EM: Look for byline indicators within class names
If we haven't found any .byline, .bylines, etc., then run a second pass
where we accept things like .article-byline and .byline__wrapper.
2025-05-08 12:23:26 -04:00
Abe Jellinek 48a0faa183 EM: Detect WordPress without generator <meta> tag 2025-05-08 12:23:26 -04:00
Skye Im 332bba842c
Library Catalog (TIND ILS): Fix record URL and add attachments (#3437)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-05-08 11:44:12 -04:00
Ilya Zonov 3ffcdba00a
Yandex Books: Fix item variable shadowing (#3444) 2025-05-06 14:41:29 -04:00
Abe Jellinek 18b44c8b1f Russian State Library: contentType -> mimeType 2025-05-01 10:52:09 -04:00
Abe Jellinek 77683d278a The Boston Globe: Fix mimeType, disable outside archive
(For now - the translator was silently failing on non-archive article pages.)
2025-05-01 10:49:17 -04:00
Abe Jellinek 44d83480a4 Reddit: Fix mimeType capitalization in tests 2025-05-01 10:44:33 -04:00
Dan Stillman 2b991e6e37 DOI Content Negotiation: Use rest API for the next couple days
Due to a Crossref outage still affecting Content Negotiation

https://status.crossref.org/
2025-04-30 16:47:33 -04:00
Dan Stillman edb3937b96 Bump lastUpdated on recent translators
GitHub changed their webhook payload on 4/7/2025, which caused the
translators repo not to get recent updates.
2025-04-28 23:07:44 -04:00
Abe Jellinek 00964a667d CourtListener: Bump lastUpdated
Seems like 8e06b8ccb2 may not have gotten
pushed out to clients.
2025-04-28 15:12:24 -04:00
aborel fa1a4c28fb
Add translator for Envidat (#3204)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-04-28 14:59:18 -04:00
Ilya Zonov 09b064e02c
Add Yandex Books translator (#3429)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-04-28 14:58:46 -04:00
Abe Jellinek 612ecfa0b7
MEDLINE/nbib: Asyncify (#3440) 2025-04-22 11:36:12 -04:00
Abe Jellinek 8e06b8ccb2 CourtListener: Attempt to update for site changes
https://forums.zotero.org/discussion/123539/connector-to-https-www-courtlistener-com-broken
2025-04-15 11:00:13 -05:00
Abe Jellinek f9081536ca HathiTrust: Update for site changes
- New Svelte-based frontend has a different search result structure and
  may not be rendered at load time, so we fall back to parsing from an
  init script if necessary
- Remove brackets from date

https://forums.zotero.org/discussion/123541/zotero-connector-not-working-on-hathitrust
2025-04-15 10:45:38 -05:00
Abe Jellinek 7b36f5a7e9 Newspapers.com: Update tests 2025-04-15 10:29:44 -05:00
Abe Jellinek d02ee39c70 Newspapers.com: Stop saving PDF attachments
PDFs are now built from images on the client side, so there's nothing we
can do.

https://forums.zotero.org/discussion/comment/490316/#Comment_490316
2025-04-15 10:27:40 -05:00
Zoë C. Ma 6abf235b7f
EconPapers: Remove FW code; multiple enhancements (#3134)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-04-08 11:01:22 -04:00
Zoë C. Ma 5aa84e297c
NASA ADS: Fix issues with detection and type-determination (#3170)
ADS: Better detection of multiple items & item types

NASA ADS (web translator):

- Detect item type more accurately
- Instead of returning "multiple" based solely on URL, try testing the
  presence of actual results ("checkOnly").
- Add elements to watch for in order to handle the
  appearance/disappearance of results by dynamic filtering.
- Detect multiple items in the "related" views (list of articles related
  to the current article in some way, including citation, similarity,
  and reader interest). If this fails (e.g. if no article cites the
  current one), fall back to identifying this page as a single article.
- Other minor fixes (prefer String#match to RegExp#exec; asyncify doWeb;
  add test case)
- Update tests

ADS Bibcode (search translator):

- More accurate logic for detecting the item type, often caused by
  invalid "TY" field in RIS or underlying data error (conference
  proceedings book identified as JOUR)
- Better detection of earlier arXiv preprints whose "bibstem" is not
  necessarily "arXiv"
- For theses, add thesis type
- Remove a test case for arXiv preprint because it has been replaced by
  the published version. Instead, add two tests for preprints that will
  never be "published" (therefore suitable as test cases in the longer
  term)
- Add test cases for conference paper, book section, and MSc thesis
- Use the "api.adsabs.harvard.edu" domain for the export API
- Don't sort the results; keep the input-order

---------

Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-04-08 10:50:36 -04:00
Abe Jellinek 0aeca28290 Datacite JSON: Don't throw when types.schemaOrg is missing 2025-04-08 10:35:23 -04:00
Abe Jellinek 437ca4d9af Reddit: Support sh.reddit.com
And:

- Asyncify
- Update target
- Remove no-op websiteTitle
- Add snapshot as document

Fixes #3439
2025-04-07 10:52:43 -04:00
Dan Stillman 66ebf4b697 Reddit: Strip trailing slash before adding .json
This might fix a 400 error on sh.reddit.com URLs (a new/future version
of the site?).

https://forums.zotero.org/discussion/123203/1645256881-zotero-connector-sh-reddit-com-json-failed-with-status-code-400
2025-04-05 04:33:53 -04:00
Dan Stillman 6e05103170 Reddit: Add missing scheme to saved URLs 2025-04-05 00:48:56 -04:00
Abe Jellinek 8eb08a3fe9 IEEE Xplore: Get cleaner data
- Clean conference titles
- Don't save snapshot when we have a PDF
- Update existing tests
2025-04-04 14:55:32 -04:00
Abe Jellinek 5b446a2066 Frontiers: Clean XML from abstract
Fixes #3433
2025-04-03 14:50:25 -04:00
ezellohar 0b2d2976dd
Primo Normalized XML: Strip authorship info after slash (#3438)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-04-03 11:48:37 -04:00
Dan Stillman 1d3f8e299c DOI Content Negotiation: Handle Crossref outage
Unplanned maintenance for March 29, 11:00 - 14:00 UTC

https://status.crossref.org/incidents/nxp3kkx4xxs3
2025-03-29 00:34:45 -04:00
Abe Jellinek 238a3df895 Types: Fix syntax errors 2025-03-28 12:24:46 -04:00
Abe Jellinek 3ff2d78a07 TIND ILS: Use 269 for date
- Convert to using the MARCXML utility function directly
- Use the new MARCXML utility to read date from 269, which is a
  non-standard MARC field
- Update tests
- Asyncify
2025-03-28 11:55:31 -04:00
Abe Jellinek 6446641421 MARCXML: Expose document -> records routine, update tests
Refactor MARCXML importer to expose a utility function, similar to
the MARC importer. This will allow consumers of the MARCXML translator
to instead decide to manually drive the process.
2025-03-28 11:55:31 -04:00
Abe Jellinek b4c2573997 MARC: Get contributor from field 720
720 is sometimes used e.g. in datasets to describe additional
contributors.
2025-03-28 11:55:31 -04:00
Abe Jellinek a11115e67b MARC: Allow caller to override item type 2025-03-28 11:55:31 -04:00
Tim Hollmann b3849ae21a
Added LWN.net translator (#3431)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-03-26 13:29:36 -04:00
Abe Jellinek a4e777f7ae Datacite JSON: Fall back to alternate titles
Fixes #3435
2025-03-26 11:27:47 -04:00
Abe Jellinek 64a54226e6 Bluesky: Fix error in detectWeb() 2025-03-26 10:26:39 -04:00
Abe Jellinek c3b8382f1d US National Archives Research Catalog: Handle URL w/ query string
https://forums.zotero.org/discussion/comment/488169/#Comment_488169
2025-03-20 11:45:05 -04:00
Abe Jellinek c39954fdd6 Amazon: Update for possible site changes
https://forums.zotero.org/discussion/comment/487747/#Comment_487747
2025-03-20 11:38:42 -04:00
Abe Jellinek 484110c925 APA PsycNET: Update for site changes
- Grab PDFs if user has access via IP
- Update item type detection
- Delete "No Pagination Specified" pages
- Update tests, remove broken search test
2025-03-10 15:49:00 -04:00
Abe Jellinek fd56161715 Web of Science Nextgen: Scrape all results from lazy-loaded pages
Export the whole search result set instead of scraping URLs from the
DOM.

Also:

- Asyncify
- Use dataset item type
2025-03-06 15:15:24 -05:00
Abe Jellinek 45e73116fd Web of Science: Fix error on single-name creator
https://forums.zotero.org/discussion/comment/487163/#Comment_487163
2025-03-06 13:43:14 -05:00
Abe Jellinek d658478af3 CI: Allow modern JS syntax 2025-03-03 16:56:59 -05:00
Abe Jellinek f7d4e977e4 Ovid: Update for site changes
- Work around stateful-only API, try not to mess up user's selection
- Fix PDF link selector
- Split semicolon-separated creators
- Save books from book database

No support for OCE yet.

https://forums.zotero.org/discussion/119214/problems-with-ovid-translator
2025-03-03 16:56:43 -05:00
Sebastian Karcher 1e263be310
Fix datacite editors (#3424) 2025-02-28 16:07:00 -05:00
Sebastian Karcher fcad450b95
Fix Scopus search (#3420)
Closes https://github.com/zotero/translators/issues/3419
2025-02-19 22:42:13 -05:00
Dan Stillman 60a7cb79e9 Update issue template and contact link description 2025-02-10 23:30:35 -05:00
Abe Jellinek 63b4ce23ab Substack: Support home URLs
No tests because these don't work unless you're logged in.

Closes #3415
2025-02-03 14:53:02 -05:00
Abe Jellinek 107cabd195 CI: Fix output parsing when translator name contains capital T
This is not ideal.

Fixes #3414
2025-01-29 14:16:05 -05:00
Tim Sherratt 248804fc82
Fix for missing attachments with Libraries Tasmania (#3412) 2025-01-29 13:59:05 -05:00
Thomas Rambø b59e11c7ba
Library Catalog (TIND ILS): Enrich item type from Schema.org (#3409)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-01-29 13:55:51 -05:00
infrahistory a93eaee137
Trove: Correct page number handling for newspapers (#3410)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-01-27 15:42:01 -05:00
Abe Jellinek bb9efc470b Washington Post: Don't scrape authors from related links
Fixes #3408
2025-01-27 15:23:59 -05:00
Wenzhi Ding d4e43e214d
Foreign Affairs: Update for site changes (#3407)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2025-01-21 11:28:12 -05:00
Stephan Hügel 8396616aa8
Add translator for Bluesky (#3400) 2025-01-15 13:00:14 -05:00
jiaojiaodubai 6497f56219
clinicaltrials.gov: fix #3403 (#3404) 2025-01-15 12:42:28 -05:00
Dan Stillman e5b6d98ea5 DOI Content Negotiation: Restore Crossref outage workaround
More planned maintenance for Jan 14, 06:00 - 11:00 UTC

https://status.crossref.org/incidents/nfjw3myvh981
2025-01-11 03:08:34 -05:00
Emiliano Heyns c84ee621e3
Citavi 5 XML: Add BibTeX Key import (#3405) 2025-01-04 01:31:51 -05:00
Abe Jellinek 368d01bb94 Open WorldCat: Handle updated response format 2024-12-17 10:41:06 -05:00
Dan Stillman 3226b5a963 CI: Update actions/cache to v4 2024-12-14 01:36:04 -05:00
Abe Jellinek 8607c377bf Goodreads: Update for site change
https://forums.zotero.org/discussion/120426/goodreads-translator-no-longer-detects-books
2024-12-11 13:50:13 -05:00
Abe Jellinek f2ddb99a63 SciELO: Use language-aware abstract and DOI
https://forums.zotero.org/discussion/120295/articles-with-versions-in-two-languages-and-two-dois
2024-12-06 13:29:41 -05:00
Bardi Harborow 5f6cf567c7
Fix Dagstuhl Research Online Publication Server translator (#3397) 2024-12-03 15:03:13 -05:00
Sebastian Karcher a2bd2f25e3
T&F: BibTeX hotfix (#3399) 2024-12-03 14:57:56 -05:00
Abe Jellinek f7f06c2538 arXiv: Parse Atom manually to work around Connector issue
https://forums.zotero.org/discussion/comment/480521/#Comment_480521

Was working fine in the client/Scaffold, but not in the browser due to
zotero/zotero-connectors#526. Easy enough to work around it for now.
2024-12-03 10:55:13 -05:00
Abe Jellinek 9f1d764903 PICA: Extract more page numbers, add missing localization, fix URL field
https://forums.zotero.org/discussion/119970/catalog-records-and-pagination-loss-in-zotero-recording
2024-11-26 10:26:33 -05:00
Abe Jellinek 4cadb3e145 PubMed Central: Throw when PMC returns error
Prevent silent failures when the backend is having issues (as it is
right now); this allows a fallback to EM, which works quite well.
2024-11-21 16:03:11 -05:00
Abe Jellinek daa4501bbe AustLII: Don't add Code to case items
https://github.com/zotero/translators/pull/2882#issuecomment-2488572263
2024-11-21 13:54:16 -05:00
Abe Jellinek 60cf886195 APS: Only pull text from abstract
https://forums.zotero.org/discussion/comment/479783/#Comment_479783
2024-11-21 13:50:45 -05:00
Abe Jellinek 6696be6cc2
arXiv: Always add DOI (#3390) 2024-11-21 12:51:46 -05:00
Abe Jellinek 21a45ca590 Wording 2024-11-21 11:53:49 -05:00
Abe Jellinek 6c34a311d0 Allow issues again? 2024-11-21 11:50:42 -05:00
Abe Jellinek 912c514fef Clarify issue reporting 2024-11-21 11:46:35 -05:00
Abe Jellinek 75b2eb9ad8 AustLII: Update tests 2024-11-20 11:03:59 -05:00
Abe Jellinek 5c77d6977d AustLII: Get court abbreviation from URL, support classic view
Fixes #3389
2024-11-20 11:01:36 -05:00
Abe Jellinek 552b3dc129 Cambridge Core: Fix book PDFs
Closes #3382
2024-11-20 10:43:17 -05:00
Abe Jellinek bdb36008ba APS: Update for site changes
Fixes #3388
2024-11-19 15:53:47 -05:00
Sebastian Karcher 43fce727d6
PMC Hotfix (#3380) 2024-11-19 13:08:45 -05:00
Abe Jellinek bc846072a5 Open WorldCat: Update ISBN ranges
https://forums.zotero.org/discussion/comment/479027/#Comment_479027
2024-11-12 11:48:21 -05:00
Abe Jellinek 7ca20decc6 OSF Preprints: Grab PDF link from page
https://forums.zotero.org/discussion/119492/pdfs-not-saved-from-psyarxiv-socarxiv-when-using-connector
2024-11-07 17:14:28 -05:00
Abe Jellinek d1bb75a7c2 CI: Update linter cache from stdin
Fixes lint errors when length of translator header is different in
memory and on disk.

Also replace cache object with Map.
2024-11-06 11:25:51 -05:00
Northword 874154ce49
Crossref Unixref XML: Remove space before sub and sup in title (#3374) 2024-10-30 11:08:15 -04:00
Abe Jellinek 51cf9bf665 Newspapers.com: Support /image/ pages as multiples
https://forums.zotero.org/discussion/comment/477807/#Comment_477807
2024-10-29 11:15:02 -04:00
Dan Stillman cdc1712be9 Lulu: Bail properly from detectSearch()
Fix to a90a241126
2024-10-24 15:26:10 -04:00
Abe Jellinek d247318f42 Frontiers: Fix getDOI() on /journals/* pages 2024-10-24 11:14:50 -04:00
Abe Jellinek 30eca8d6e4 Newspapers.com: Update for site changes
- Unify clipping and article scraper code
- Update target

https://forums.zotero.org/discussion/119049/newspapers-com-metadata
2024-10-24 10:55:39 -04:00
Dan Stillman a90a241126 Lulu: Fix `unreachable code after return statement` warnings
And fix inconsistent return
2024-10-24 00:02:27 -04:00
Abe Jellinek 76fab728fa arXiv: Fix ID extraction when URL has hash
https://forums.zotero.org/discussion/118985/zotero-connector-bug-failed-to-save-arxiv-page
2024-10-22 12:12:38 -04:00
Abe Jellinek 448baccad0 ProQuest: Update for site changes
- Support "Full Citation" view (inline metadata on viewer page)
- Parse "Degree date"
- Fix publicationTitle being set to place for some newspapers
- Pull Historical Newspapers dates and pages
- Remove session IDs from URLs
- Update tests where possible

https://forums.zotero.org/discussion/comment/477153/#Comment_477153
2024-10-22 12:07:06 -04:00
Abe Jellinek 017fdf0f44 Delete arXiv Vanity 2024-10-09 10:34:56 -04:00
Abe Jellinek 115162d2eb K10plus ISBN: Remove 'pica.mat' filter
Seems to be excluding valid results.

https://forums.zotero.org/discussion/comment/467454/#Comment_467454
2024-10-09 10:25:53 -04:00
Jonas Zaugg 30664cea8f
arXiv: Use Atom API instead of OAI (#3366)
Co-authored-by: zoe-translates <116055375+zoe-translates@users.noreply.github.com>
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-10-09 09:57:09 -04:00
Abe Jellinek e6f65ba72c clinicaltrials.gov: Use new API
- Old API removed
- Classic site is no longer available

https://forums.zotero.org/discussion/118562/persistent-issues-pulling-from-clinicaltrials-gov
2024-10-08 14:21:30 -04:00
Abe Jellinek 56c3b87d7d
ScienceDirect: Don't add `isDTMRedir` URL param (#3368) 2024-10-03 10:30:37 -04:00
Abe Jellinek e7d033c178 ACS Publications: Don't use Object.hasOwn()
Not supported on older browsers.
2024-09-30 09:50:25 -04:00
Abe Jellinek 518493acb9 IEEE Xplore: Use direct PDF URL as fallback
May address https://forums.zotero.org/discussion/118231/no-import-of-pdfs-from-ieee-explore-via-connector-firefox-possible
2024-09-30 09:42:02 -04:00
Abe Jellinek 60ab069092 DOI Content Negotiation: Update tests 2024-09-27 10:37:09 -04:00
Abe Jellinek f784fff615 DOI Content Negotiation: Remove CrossRef outage workaround
Outage is over.

Reverts 87bb5b2647
2024-09-27 10:36:04 -04:00
smachefert 22fa76e1fe
Primo: Grab callNumber in <bestlocation>, remove failing tests (#3360) 2024-09-26 10:37:40 -04:00
Sylvain Machefert ce30da9524
PICA: Fix Sudoc multiples (#3362) 2024-09-26 10:26:12 -04:00
aldente-hu 263546a74e
CiNii Articles -> CiNii Research, update for site changes (#3363)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-09-26 10:24:39 -04:00
Abe Jellinek 2c553e90a7 IEEE Xplore: Log PDF page contents when regex doesn't match
https://forums.zotero.org/discussion/118231/no-import-of-pdfs-from-ieee-explore-via-connector-firefox-possible
2024-09-26 09:31:16 -04:00
Dan Stillman 87bb5b2647 DOI Content Negotiation: Handle upcoming Crossref outage
Crossref is retrying their maintenance from last month on Sep. 16-17,
which means content negotiation for Crossref DOIs will be down for
another 24-hour period. (Last time they didn't actually realize it was
down -- I told them they were returning 200s with 503 error messages in
the body -- and this time they're doing it intentionally...) So during
that period, make an extra request to check the registration agency of
each DOI, and if it's Crossref, use their REST API, which is remaining
up.
2024-09-14 22:15:04 +02:00
Martynas Bagdonas 41673978cf
Update Crossref REST translator (#3359) 2024-09-14 15:53:51 -04:00
Tim Sherratt 3b4ec8298e
minor fix for Queensland State Archives (#3356) 2024-09-03 11:24:13 -04:00
Abe Jellinek 6c9d01f6a3 Emerald Insight: Use new API when possible
Closes #3332
2024-08-29 11:32:15 -04:00
Adam J Bravo b3dd8cfa6c
Adding translator for Library of Congress Digital Collections (#3354)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-08-22 10:23:45 -04:00
Abe Jellinek 9eb7cabbef
DOI: Recover when one DOI fails to resolve (#3312) 2024-08-21 18:09:03 -04:00
Tim Sherratt ca01e23e65
Add translator for Public Record Office Victoria (#3233) 2024-08-21 15:48:59 -04:00
Abe Jellinek b39ffb20c4 QSA: Anchor regex 2024-08-21 15:41:55 -04:00
Tim Sherratt e62d24350a
New translator - Queensland State Archives (#3355)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-08-21 15:41:12 -04:00
Abe Jellinek d515188ec4 Delete HLAS (historical) 2024-08-21 13:47:20 -04:00
Adam J Bravo 3439b09f9e
National Archives: Update API URL, add catalog, external links (#3353)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-08-21 13:44:07 -04:00
Abe Jellinek 1ca9f86eb5 De Gruyter: Book section improvements
- Get editors from RIS
- Get full book title, not just part before colon
2024-08-12 15:43:00 -06:00
yuchen-lea 1b7d772db0
Douban: support numeric userID for multiple (#3350) 2024-08-08 12:55:58 -06:00
Abe Jellinek f8bc01e48c TinREAD: Filter out dummy series items
https://forums.zotero.org/discussion/comment/469492/#Comment_469492
2024-08-01 10:15:57 -04:00
Franklin Pezzuti Dyer 1124865649
Add translator for TinREAD library catalogs (#3223)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-07-30 10:57:40 -04:00
Sebastian Karcher f8f3277788
Add OpenAlex web and JSON translator (#3269)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-07-30 10:48:21 -04:00
Dan Stillman 6aa0d2f3bf ACM: Fix PDF downloads
Closes #3348
2024-07-30 01:21:06 -04:00
Abe Jellinek d8006e0af2 RERO ILS: Handle authorized_access_point + edge cases
https://forums.zotero.org/discussion/116276/rero-ils-translator-broken
2024-07-24 16:02:07 -04:00
Abe Jellinek 5f03dc91ba
ProQuest: Support Archive Finder and site changes (#3341) 2024-07-24 09:53:25 -04:00
Alex T. 7baf5eb647
eLibrary.ru: Name parsing logic fixes, test updates (#3338) 2024-07-24 09:51:15 -04:00
Sebastian Karcher 21a40178c3
Fix JAMA (Silverchair) (#3335)
https://forums.zotero.org/discussion/115948/cannot-import-pdf-file-from-jama#latest
2024-07-24 00:24:28 -04:00
Abe Jellinek f5d465b7aa Merge Springer Books into Springer Link
Move tests (which are no longer very useful since they're all
multiples - need to figure that out!) to Springer Link. No other changes
necessary.

Closes #3304
2024-07-22 16:12:23 -04:00
Alex T. d02d3f7b6a
The Met: Update for site changes, asyncify, lint (#3345) 2024-07-22 15:04:06 -04:00
Alex T. 5908f0f6f8
ePrint: add support for non-PDF attachments (#3337) 2024-07-22 15:02:05 -04:00
Abe Jellinek c7199cc0bd CI: Group log lines 2024-07-22 14:58:55 -04:00
Sebastian Karcher aa67ced33e
On master: Update WaPoCover additional formats; asyncifySee https://forums.zotero.org/discussion/115760/problems-with-washington-post-translator/p1 (#3336) 2024-07-13 23:59:50 -04:00
Martynas Bagdonas 0fd931ab9b
Add underline annotation support to Markdown and HTML translators (#3334) 2024-07-11 04:59:56 -04:00
Abe Jellinek c528844c36 ERIC: Don't set duplicate pub title on reports
And update tests for other changes.
2024-07-05 07:59:21 -04:00
Abe Jellinek e368f7b784 ProQuest: Fix multiples on MV3
https://forums.zotero.org/discussion/115508/zotero-connector-not-working-for-proquest-databases-on-chrome
2024-07-05 07:56:52 -04:00
Dan Stillman 11d37c9c91 IEEE Xplore: Fix saving from PDF URLs and maybe some search pages
But search pages aren't detecting properly for me, so that might need to
be fixed separately

Fixes #3333
2024-07-05 03:21:38 -04:00
Abe Jellinek fdcdb127ac ProQuest Ebook Central: Monitor DOM changes for search results 2024-07-03 13:15:09 -04:00
Abe Jellinek 61cab7f51b ProQuest Ebook Central: Fix multiples
- New URL format (kept the old in case some instances still use it)
- Result links go to a redirect page, so rewrite the URLs to skip it
2024-07-03 13:12:32 -04:00
Abe Jellinek 64509648bb
T&F+NEJM: Refactoring, site changes, support reader pages (#3330)
- Asyncify
- Support new NEJM issue pages
- Get dates from HTML
- Use default ISSN for NEJM
- Clean up tags
- Don't grab broken creators from RIS
- Support PDF/EPUB reader pages and download EPUBs
2024-07-03 06:32:49 -04:00
Abe Jellinek 7dc9469a8b CI: Disallow document global 2024-06-27 12:12:30 -04:00
Sondre Bogen-Straume e2bcb03a15
Add translator for Brukerhåndboken (#3297)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-06-27 12:05:45 -04:00
Abe Jellinek 7d3a67b6ee SVT Nyheter: Rewrite and update for site changes
Fixes #3326
2024-06-27 11:32:09 -04:00
advoropaev 0374a06a47
eLibrary.ru: Update for site changes (#3289)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-06-24 15:36:35 -04:00
Dave Bunten dbe6fe123c
Add translator for CITATION.cff file references (#3274)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-06-24 15:06:54 -04:00
Adomas Ven 682cb285cd
IEEE Xplore: Remove detect web check for top-frame (#3322)
This was added in 2012 (2534bcdb) for Z4FX and is no longer relevant
in any place where we run translation
2024-06-19 03:55:56 -04:00
Abe Jellinek ee9ed8df2c Bangkok Post: More tweaks
- Remove getMetaTag(), just use attr()
- Fix opinion piece author extraction
2024-06-18 16:47:07 -04:00
Matt Mayer dda46ea9b5
Fix Bangkok Post translator (#3308) 2024-06-18 16:39:58 -04:00
Abe Jellinek 427d10c137
Brill: Update for site changes (#3319) 2024-06-14 11:38:12 -04:00
Abe Jellinek fa69cf7b65 ScienceDirect: Don't save snapshots on search results (#3320)
Closes #3316
2024-06-14 08:03:53 -04:00
Abe Jellinek 241a99cf72 ScienceDirect: Asyncify (#3320)
Closes #3315
2024-06-14 08:03:36 -04:00
Abe Jellinek 09e3751758 PubFactory Journals: Remove meta-in-body workaround (#3318) 2024-06-14 00:46:30 -04:00
Abe Jellinek 047cda3a84 EM: Always look for meta tags in head and body (#3318) 2024-06-14 00:46:24 -04:00
Brendan O'Connell b947ce66c9
Add PubFactory Journals (#3009)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-06-04 14:15:43 -04:00
Abe Jellinek 8f6c91b0d6 De Gruyter: Fix books being saved as sections
https://forums.zotero.org/discussion/105177/zotero-connector-saving-book-as-book-chapter-from-de-gruyter
2024-05-29 13:11:21 -04:00
Abe Jellinek 6a0d413b79 Twitter: Quick fix for translation error
We've lost URL unshortening on most versions of the site for now, but at
least it doesn't error. They seem to be A/B testing, or maybe just
randomizing, the way links are displayed.

Sometimes (and *always* with an ad blocker enabled) I'm actually seeing
links displayed in full on the page, without t.co shortening; without an
ad blocker, it varies between that layout and one where the full URLs
are nowhere in the page source, meaning there's likely no way for us to
unshorten them.

https://forums.zotero.org/discussion/114434/twitter-x-translator-extension-resorts-to-generic-embedded-metadata
2024-05-24 13:09:02 -04:00
Sebastian Karcher c140b80588
Update Datacite JSON (#3280) 2024-05-17 16:20:43 -04:00
Joey Takeda 650cbb8564
Rewrite of DHQ Translator (#3306)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-05-15 11:10:26 -04:00
Abe Jellinek c46011097e CI: Don't report lint error when testCases is empty 2024-05-10 13:08:23 -04:00
Sebastian Karcher d0e7827d06
Fix EBSCOhost Title & PDF download (#3300) 2024-05-09 12:56:03 -04:00
Abe Jellinek 3871bb2a11 Springer Link: Support new book chapter list structure
Fixes #3302
2024-05-09 12:41:20 -04:00
Abe Jellinek ffb252e58b
Note HTML & Note Markdown: Add annotation key to all reader links (#3298) 2024-04-24 11:00:03 -04:00
sebastian-berlin-wmse b3dd2b40c1
Add translator for LIBRIS ISBN (#3184) 2024-04-23 14:47:31 -04:00
Geoff Banh 82f28ce75a
YouTube: Fix missing fields when run from translation-server (#3293) 2024-04-11 12:25:04 -07:00
Dan Stillman 5af5f73c11 Twitter: Detect on x.com as well for mobile app
The iOS app uses x.com, while the website still uses twitter.com.
2024-04-05 04:17:28 -04:00
Georg Mayr-Duffner b04cfc962f
PNX: Remove $$0-prefixed authority information (#3295) 2024-04-04 13:59:09 -04:00
Abe Jellinek 3acc13a70d CI: Apply --diff-filter=d to all diff calls 2024-04-04 12:24:31 -04:00
Abe Jellinek 820b285549 CI: Don't try to lint deleted translators 2024-04-04 11:57:43 -04:00
jiaojiaodubai d6e325dc1d
Web of Science Nextgen: Support .cn top-level domain (#3294) 2024-04-03 02:03:12 -04:00
Alex T b6d1b858e8
Research Square: fix publication date retrieval (#3292) 2024-04-01 15:23:07 -04:00
wolf 7efeb1955c
Fix multi detect in JSTOR (#3291) 2024-04-01 14:55:50 -04:00
Geoff Banh ff73d0dcb8
Embedded Metadata: Exclude single "Condé Nast" W3 author (#3287) 2024-03-27 16:11:37 -04:00
Sebastian Karcher de439f74c3
Update TimesMachine (#3286)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-03-27 11:52:48 -04:00
Kun CHEN 97cd07f406
Fix APA PsycNET `fulltext` match issue (#3276) 2024-03-25 14:19:13 -04:00
Sebastian Karcher 0cd3df5ef7
Update CrossRef for Preprints et al. (#3278) 2024-03-25 11:30:17 -04:00
Sebastian Karcher e5d3420edf
Updates to use preprint item type (#3279) 2024-03-25 11:21:14 -04:00
Abe Jellinek b2c73c9638 .eslintrc: Don't add blank line before /** END TEST CASES **/ 2024-03-25 11:20:41 -04:00
Lars Willighagen a3591e1ef7
Exclude French plural definite article from citekeys (#3283) 2024-03-25 11:09:47 -04:00
aborel 1c99c1a2b0
Zenodo -> InvenioRDM, support more repositories (#3206)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2024-03-20 10:52:41 -04:00
Sebastian Karcher d81f5fdb5d
Fix OSF Preprints (#3277)
remove tests for preprint item type -- that's now 2 years old.
2024-03-19 22:29:41 -04:00
Abe Jellinek 1d7c11ec5a
Note HTML & Note Markdown: Support EPUB/snapshot annotations (#3253) 2024-03-19 11:47:31 -04:00
aldente-hu f3404ea73f
J-Stage: Handle Japanese names properly (#3157)
Co-authored-by: zoe-translates <zoe.ma@pm.me>
2024-03-19 10:13:56 -04:00
Sebastian Karcher ab9cb7adce
Update Turkish National Library, lint MARC (#3271) 2024-03-18 12:16:07 -04:00
Sebastian Karcher 5b3600e8a2
Fix longstanding bug for L with stroke (#3275)
https://forums.zotero.org/discussion/70322/ive-notice-that-zotero-has-a-problem-with-polish-letter-l-k#latest
2024-03-17 23:38:47 -04:00
Abe Jellinek 41966c2d0b CI: Improve header-translator-type rule
- Add detectSearch and doSearch to the list of handlers we check
- Warn very explicitly when a web translator declares too many types
2024-03-14 17:25:06 -04:00
Abe Jellinek c18f6ee030 CBC: Not a search translator
06ba6d625f (r139804051)
2024-03-14 16:55:22 -04:00
Abe Jellinek 06ba6d625f Merge branch 'geofferb/master' 2024-03-14 15:03:38 -04:00
Abe Jellinek facbef8de9 CBC: Small fixes
- Update target to include slash
- Update one test for data change
2024-03-14 15:03:25 -04:00
geoff B d916216f99 Add translator for CBC.ca 2024-03-14 15:03:25 -04:00
Abe Jellinek ea4775bd1b Springer Link: Support new journal layout
Fixes #3247
2024-03-11 13:59:32 -04:00
Abe Jellinek e8a2581696 Publications Office of the EU: Download one PDF, improve metadata
- Only detect when DOI is present, since we search using that
- Use innerText for search result labels so <br>s become spaces
- Download current-language PDF if possible, falling back to English and
  then anything available
- Don't parse institutional authors
- Remove "LU" place
- Add tags
2024-03-08 12:58:35 -05:00
Laurence Stevens 251549a4c2
Add translator for The Independent (#3251) 2024-03-07 10:56:25 -05:00
Sebastian Karcher 86a51975f4
Fix author split in T&F ebooks (#3267) 2024-03-07 10:52:57 -05:00
zoe-translates ab50e8c580
Frontiers: Improve metadata, save supplements & multiples (#3145) 2024-03-05 15:16:30 -05:00
Dan Stillman 49dc06a079 eLife: Fix PDF downloads
https://forums.zotero.org/discussion/112526/saving-from-elife-does-not-download-pdf
2024-03-05 05:53:33 -05:00
EdwardGao 42cc3d5edc
Google Presentation: Update PDF export URL (#3259) 2024-02-29 12:27:09 -08:00
Abe Jellinek 7bed28c0ed Nature: Delete number when it matches issue, update tests
Fixes #3255
2024-02-29 12:23:44 -08:00
Philipp Zumstein 8cc630507f
Zenodo: Support multiples in Communities (#3263) 2024-02-29 12:14:23 -08:00
Abe Jellinek 7c0b19974d CI: Update `chromedriver`
Fixes #3258
2024-02-28 13:37:10 -08:00
Abe Jellinek 9a1d789475 T&F: Add subtitle if present 2024-02-28 13:21:17 -08:00
Abe Jellinek bad6238df3 Crossref Unixref XML: Remove extra colon when adding subtitle 2024-02-28 13:21:17 -08:00
Abe Jellinek e7004416a8 Primo Normalized XML: Recognize 'pbooks' as book
https://forums.zotero.org/discussion/112192/wrong-item-type-for-books-primo-ve
2024-02-26 17:42:02 -08:00
Adomas Ven e84ecfb370
CI: Specify the Chrome extension key. See zotero/zotero-connectors#460 (#3260) 2024-02-20 07:44:26 -05:00
Sebastian Karcher 7837c42670
Fix CambridgeCore RIS regex. asyncify (#3257) 2024-02-18 13:27:27 -05:00
Franklin Pezzuti Dyer c07d2dfb97
Adding Harvard Caselaw Access Project translator (#3230)
Fixes zotero/translators#3225
2024-02-17 23:01:23 -05:00
Sebastian Karcher ee832ffcda
Fix ORCID ID links appearing in ProQuest author list (#3256)
https://forums.zotero.org/discussion/111918/link-to-external-site-problem#latest
2024-02-17 22:56:56 -05:00
Abe Jellinek edf44a1943
ScienceDirect: Capture italics in titles, update tests (#3246) 2024-02-08 13:05:33 -05:00
Abe Jellinek 12021cddbb YouTube: Grab correct creator name on desktop
https://forums.zotero.org/discussion/111148/saving-youtube-videos-have-the-wrong-director
2024-02-05 13:28:34 -05:00
Sebastian Karcher ac6628e867
Update EBSCO DL Search (#3248)
And do a bit more for item type. Reported: https://forums.zotero.org/discussion/111468/zotero-connector-eds-ebsco-discovery-service-not-working-correctly/p1
2024-02-04 14:41:35 -05:00
Sebastian Karcher cc94c2f725
Add CourtListener (#3226)
Closes  #3224
2024-02-04 14:39:25 -05:00
wolf d955310149
Unbreak NYPL translator when annotatedMarc = null (#3237)
* unbreak when annotatedMarc = null

* bump timestamp
2024-01-27 04:17:31 -05:00
Kagami Sascha Rosylight 469b1b0576
Replace newline to space with xargs (#3213) 2024-01-22 16:51:45 -05:00
Kagami Sascha Rosylight 4a8bd03064
Wait for `translatorServer.serve()` (#3231) 2024-01-17 09:32:04 -08:00
Sebastian Karcher 35fc547908
Fix Retsinformation (#3227)
after update of internal API.
Reported: https://forums.zotero.org/discussion/109451/problems-with-translator-retsinformation#latest
2024-01-15 23:57:59 -05:00
Sebastian Karcher 564c65cb90
DNB Hotfix (#3228)
asyncified but left other code like xpaths in place

reported: https://forums.zotero.org/discussion/110825/translator-deutsche-nationalbibliothek#latest
2024-01-15 23:57:13 -05:00
Abe Jellinek 6b4a4dce60 CI: Use constant extension ID
Thanks @saschanaz: https://github.com/zotero/translators/pull/3210#issue-2058323242
2024-01-09 20:54:03 -05:00
Sebastian Karcher d24b779808
BnF Fix multiples (#3221)
https://forums.zotero.org/discussion/comment/451953#Comment_451953
2024-01-08 23:05:06 -05:00
Sebastian Karcher 8e3f5722e3
Fix Rechtspraak.nl (#3220)
https://forums.zotero.org/discussion/110653/zotero-connector-no-longer-working-rechtspraak-nl/p1
2024-01-08 23:04:45 -05:00
Elsa Granger c73db0a6b2
Use https when access export.arxiv.org (#3216) 2024-01-05 07:41:18 -05:00
Kagami Sascha Rosylight 8cc91dcff1
Run `npm run lint` only when there's any translator change (#3212) 2023-12-28 15:05:25 -05:00
Dan Stillman 713999d25c ScienceDirect: Fix detection on pages with query strings containing "pdf"
https://forums.zotero.org/discussion/110434/60091619-sciencedirect-author-and-pdf
2023-12-28 06:22:33 -05:00
Emiliano Heyns 450efe2d87
stock eslint support (#3177) 2023-12-27 05:28:32 -05:00
aborel 3ad35cf1e3
Zenodo2023 (#3202) 2023-12-08 04:56:33 -05:00
jiaojiaodubai 7bf0dfbede
Adapt to search pages; Update test cases (#3193) 2023-12-01 04:10:54 -05:00
Sebastian Karcher db2771d52d
EBSCO DL - More URL changes (#3192) 2023-11-26 23:23:13 -05:00
l0o0 eb9fca0787
fix: Update request for exporting CNKI refworks text. Update function to find CNKI database keyword for saving multiple items. Update the matching relationship between dbcode and item type (#3191) 2023-11-23 02:26:02 -05:00
zoe-translates 4d6204d400
Update Haaretz (#3176) 2023-11-06 10:20:12 -05:00
Peter Coombe f4741eca4c
Hyphenated "access-date" in Wikipedia Citation Templates.js (#3178)
Wikipedia citation templates have preferred hyphenated "access-date" parameter rather than "accessdate" for many years. See https://en.wikipedia.org/wiki/Help:Citation_Style_1#Access_date
2023-11-05 16:49:13 -05:00
zoe-translates fd45efc081
Refer/BibIX import: recognize value "Audio" for %0 (type) tag (#3174) 2023-10-27 14:36:06 -04:00
zoe-translates 6df218c9b8
ACS Publications: Fix PDF attachment and supplements; recognize more target pages; efficiency improvements (#3128) 2023-10-27 14:33:06 -04:00
Abe Jellinek 5333a7eb61 T&F+NEJM: Support `/doi/10.` pages
Fixes #3160
2023-10-27 12:04:29 -04:00
zoe-translates ccad9be5bd
Cambridge Engage: Fixes for search; minor date normalization (#3166) 2023-10-24 13:49:51 -04:00
zoe-translates 0121bf0fce
Cairn.info: Serialize requests; fix PDF attachment URL (#3165) 2023-10-24 13:49:34 -04:00
zoe-translates 0fdbcd0fd4
Duke Univ. Press: Serialize multiples, add test case (#3167) 2023-10-24 13:48:42 -04:00
Abe Jellinek 5bc9435b63 CI: Clarify error when run outside a git clone
find-root's default message is "package.json not found in path", which
isn't accurate: we look for .git/, not package.json.
2023-10-24 12:13:57 -04:00
vinothk-hw 9518fb4cdd
Add translator for AccessScience (#3127) 2023-10-19 03:03:40 -04:00
Lars Willighagen 30dcd15276
Add ZOBODAT (#3156) 2023-10-18 10:47:22 -04:00
Dan Stillman 7c4cc221d9 DOI: Serialize DOI Content Negotiation requests 2023-10-18 07:18:22 -04:00
vinothk-hw 9fd351f0ea
Update author and multiple scenario (#3125) 2023-10-16 17:03:02 -04:00
zoe-translates 606ba8218d
The Atlantic: Remove FW code; update for newer website (#3132) 2023-09-26 12:51:27 -04:00
zoe-translates f94af5d875
ESLint plugin: Allow array (of objects) as search translator input (#3149) 2023-09-26 12:18:50 -04:00
Abe Jellinek 394f5b715d CBdL ISBN: Fix error on non-ISBN searches
Fixes #3147
2023-09-26 12:11:27 -04:00
Sebastian Karcher 113b77b14b
Fix IEEE after site change (#3150) 2023-09-24 04:14:34 -04:00
zoe-translates 158299ca47
Google Scholar: Add delays between consecutive network requests. (#3043)
Also:

* Better emulation of page navigation.
* Use external services (DOI and ArXiv API) when possible.
2023-09-23 00:52:37 -04:00
zoe-translates 7711e87f07
DOI Content Negotiation (search translator): Asyncify, serialize requests (#3148)
- doSearch() is turned into an async function. Processing of next input
  DOI string only begins after the previous one has been processed. This
  means no more than one request to the CrossRef service is outstanding
  at any time.
- Add a test case with multiple inputs.

Cf.
https://forums.zotero.org/discussion/107976/importing-references-using-doi-failed
2023-09-22 06:43:39 -04:00
aborel 8e5c648bb1
New web translator: https://www.e-periodica.ch (#3008) 2023-09-21 01:41:33 -04:00
Sebastian Karcher 6a2e0b7825
Fix PhilPapers (#3133) 2023-09-20 13:11:32 -04:00
zoe-translates f88a29b3f0
ClinicalTrials.gov: Don't use Array#at(); don't reinvent ZU.strToISO() (#3139) 2023-09-17 21:46:48 -04:00
zoe-translates e9a6b958c8
IPCC: Use final versions of AR6 WG2 chapters in PDF attachments (#3143) 2023-09-17 21:41:16 -04:00
Sebastian Karcher 0f67da4c73
Fix for EBSCO DL (#3138)
https://forums.zotero.org/discussion/107688/zotero-connector-ebsco-discovery-service/p1

Only have the one guest access, but looks like this is really just a change in the bas URL.
2023-09-17 06:45:58 -04:00
Jacob Lee 5f7e0bd99f
Encyclopedia of Korean Culture (#3122) 2023-09-15 21:59:13 -04:00
Sebastian Karcher fdcacbd9ac
Scopus: Update for new search interface (#3120) 2023-09-15 16:56:06 -04:00
Abe Jellinek 42e14d3be0
Add Câmara Brasileira do Livro ISBN search (#3091) 2023-09-15 16:39:10 -04:00
zoe-translates 868a29413d
New translator: Bosworth-Toller dictionary of Old English (#3027) 2023-09-13 10:28:34 -04:00
zoe-translates 7363e03f77
Boston Review: Fix broken translator; remove FW code (#3106) 2023-09-13 10:27:07 -04:00
Marielle Volz 9868aebb9e
Wikidata: Skip linked resources that contain no RDF metadata (#3109) 2023-09-13 10:24:36 -04:00
Dan Stillman 5187948c67 Library of Congress ISBN: Use the new HTTPS endpoint 2023-08-25 01:07:21 -04:00
zoe-translates 1fcdcbaa9f
Climate Change and Human Health Literature Portal: Fix errors (#3111) 2023-08-24 11:28:22 -04:00
zoe-translates 56f29b8877
APA PsychNet: Prevent flooding when saving multiple; lint cleanup (#3115) 2023-08-24 11:27:31 -04:00
zoe-translates 3e73b583eb
Foreign Affairs: multiple bugfixes (#3119) 2023-08-24 11:25:27 -04:00
Abe Jellinek 4c39a47b0f ProQuest: Update PDF link selector
https://forums.zotero.org/discussion/107136/zotero-connector-proquest-connector-not-importing-pdf-file
2023-08-24 11:19:36 -04:00
Sebastian Karcher 70aa1e2076
Add AquaDocs (#2934)
Requested: https://fediscience.org/@thalassa/109303603306517407

Much of the DC data is not actually in the page header & not in the default output formats, so going through the XML.
2023-08-24 05:38:28 -04:00
zoe-translates 0145a6d1e7
Preprints.org: Avoid flooding with multiples; update element for outlink (#3117)
- Avoid flooding when saving multiples; cf. #2983
- Don't access members of null (result of unmatched selector); this is
  caused by the change to site layout and content for preprints with
  peer-reviewed version.
2023-08-23 04:12:08 -04:00
zoe-translates b6eb880277 Open WorldCat: Fix lint errors
This is done to prevent annoying lint failures in CI
2023-08-22 01:25:00 -04:00
zoe-translates b4f925cbbd Open WorldCat: Don't send requests at once when saving search results
Cf. #2983

In addition, a test case with redirect is deferred to prevent spurious
timeout.
2023-08-22 01:25:00 -04:00
zoe-translates 2e467e0478
ESLint rules: Add "ericNumber" to the allowed keys for search translator (#3114)
This prevents the spurious lint errors in ERIC.js caused by the key
"ericNumber".
2023-08-22 01:24:28 -04:00
zoe-translates a4596b5540
ERIC: fix flooding when saving multiple items from search results (#3113)
Cf. #2983
2023-08-22 01:24:18 -04:00
Dan Stillman 999764abc2 DOI: Update timestamp again 2023-08-18 05:22:35 -04:00
Dan Stillman 083c9e0d79 DOI: Update timestamp 2023-08-18 05:15:25 -04:00
Dan Stillman 937f29704a Revert "DOI web overhaul (#3015)"
Probably causing https://forums.zotero.org/discussion/comment/441290/#Comment_441290

This reverts commit 07bbb58919.
2023-08-18 05:08:11 -04:00
zoe-translates a847b8984c
New York Review of Books: Fix translator broken by site updates (#3094) 2023-08-17 16:21:21 -04:00
Abe Jellinek 8ce9ce194d
Merge pull request #3083 from zoe-translates/embedded-metadata-optional-search-body-for-meta 2023-08-17 16:14:51 -04:00
Abe Jellinek daaa60382d Brill: Always set searchForMetaTagsInBody = true 2023-08-17 16:04:10 -04:00
zoe-translates 5112951e99
Al-Sharekh: Fix detection of multiples; asyncify (#3084) 2023-08-17 15:58:00 -04:00
zoe-translates de71137dc6
index.d.ts: Remove declarations of functions moved to internal namespace (#3093) 2023-08-17 15:28:56 -04:00
zoe-translates 5a6bf02961
New translator: Literary Hub (#2991) 2023-08-17 15:15:06 -04:00
zoe-translates 07bbb58919
DOI web overhaul (#3015) 2023-08-17 15:13:55 -04:00
Brendan O'Connell 839a1b74be
Add COBISS library catalog (#2985)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2023-08-17 14:59:40 -04:00
Abe Jellinek 51ed2d95da Twitter fixup: Non-capturing group 2023-08-17 14:36:16 -04:00
Abe Jellinek f15c4238a9 Twitter: Update regex
Sorry, I mean X.

https://forums.zotero.org/discussion/107010/zotero-connector-twitter-x-translator-seems-broken
2023-08-17 14:30:22 -04:00
Abe Jellinek 2928aa1bc4 RERO ILS: Fix and update tests
- Detect more item types using existing mapping
- Handle more cases where creator metadata has been moved to an external
  JSON document
- Update tests

https://forums.zotero.org/discussion/106951/rero-ils-site-translator-broken
2023-08-17 11:06:10 -04:00
zoe-translates 61558f8a7b [Minor] Fix an ESLint warning for unused parameter in function 2023-08-16 23:19:16 +08:00
zoe-translates 2682e4c58a EM: Workaround for <meta> from head ending up in body due to invalid HTML
A fairly common consequence of being served invalid HTML is that after
parsing, <meta> elements that should have gone into the <head> end up in
the <body> in the output of DOM parser.

This breaks the EM translator which only looks for <meta> tags that are
immediate descendants of <head> -- the sensible behaviour for
well-behaving documents.

To work around this issue, the default behaviour is not changed, and a
configurable flag is introduced to override it.

When the `searchForMetaTagsInBody` property is set to true, <meta> tags
will be searched for in the immediate descendants of <body>.

With this workaround, Web translators that calls the EM translator don't
have to manipulate the document by putting <meta> elements into the
head manually.

This reduces the likelihood of unintentionally mutating the DOM, and it
keeps the EM-based translator code's cleaner.

A real-world example is the Brill translator, also fixed in this commit.
2023-08-16 23:19:09 +08:00
Alex Tereschenko 9180801bd8
ePrint: refactor to modernize, fix issues, and add functionality (#3079) 2023-08-14 06:31:41 -04:00
morganfshirley e1241286b1
Updated Electronic Colloquium on Computational Complexity translator (#3040) 2023-08-14 06:30:27 -04:00
Sebastian Karcher c3c67911ff
Fix linting on NLoP (#3051) 2023-08-14 04:27:33 -04:00
Marielle Volz 06fed1df88
EM: Fix bug where Facebook profiles get added to author field (#3103)
Fix bug where authors from open graph metadata fields only got added if they contained a Facebook link (as opposed to the intended result which is to skip the field if it did).
2023-08-11 05:16:07 -04:00
Abe Jellinek 27f711219b Open WorldCat: Disable ESLint for ISBN ranges
To fix horrible performance in Sublime, which apparently is not
optimized for thousands of lint errors.
2023-08-08 18:53:16 -04:00
Abe Jellinek f3d77f2327 Open WorldCat: Fall back to archived build ID 2023-08-08 18:53:16 -04:00
Pascal Quach c86fe6b0ad
Add Optimization Online translator (#3042) 2023-08-06 23:11:27 +02:00
Alex Tereschenko 7fc02305ef
Zenodo: use preprint item type, add a respective test (#3100)
Closes #3056.
2023-08-06 16:27:23 -04:00
Alex Tereschenko 1590d01890
Fix CI check breakage due to chromedriver changes (#3101)
As of version 115, ChromeDriver uses different package distribution
method (more details at https://googlechromelabs.github.io/chrome-for-testing/),
and currently used version 95.0.0 is not able to handle that,
so all PR checks fail with the following message:

    Your Chrome version is 115.0.5790.110
    Finding Chromedriver version.
    ChromeDriver installation failed Error: Request failed with status code 404
        at createError (/home/runner/work/translators/translators/node_modules/axios/lib/core/createError.js:16:15)
        at settle (/home/runner/work/translators/translators/node_modules/axios/lib/core/settle.js:17:12)
        at IncomingMessage.handleStreamEnd (/home/runner/work/translators/translators/node_modules/axios/lib/adapters/http.js:269:11)
        at IncomingMessage.emit (node:events:539:35)
        at endReadableNT (node:internal/streams/readable:1345:12)
        at processTicksAndRejections (node:internal/process/task_queues:83:21) {
      config: {
        url: 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790',
        method: 'get',
        headers: {
          Accept: 'application/json, text/plain, */*',
          'User-Agent': 'npm/8.11.0 node/v17.9.1 linux x64 workspaces/false ci/github-actions'
        },
    <...and so on...>

Just updating the chromedriver package is enough to fix, so here it is.

Tested on my fork of the repo, see e.g.,
https://github.com/alex-ter/translators/actions/runs/5777601767/job/15657962595?pr=1
2023-08-06 16:25:39 -04:00
Dan Stillman 3f7531774d Airiti: Remove search flag
Follow-up to c9784da115
2023-08-04 01:04:23 -04:00
Abe Jellinek ca1b311eb0 Add index.d.ts updater script and update item types 2023-08-03 11:52:01 -04:00
Justin Warren b68ed12912
AustLII translator updates (#2882) 2023-08-03 08:39:13 -04:00
hackbunny 2b08a392f7
Twitter: Update title regex (#3092) 2023-08-02 22:49:42 -04:00
Sebastian Karcher 756ce0791c
MathSciNet Update for new site (#3072) 2023-08-02 02:34:29 -04:00
Dan Stillman c9784da115 Airiti: Update tests
A couple are still returning the wrong item type
2023-07-31 17:06:18 -04:00
Dan Stillman bb8c02b5fc Airiti: Remove search translation
Closes #3088
2023-07-31 17:05:22 -04:00
Marielle Volz fc532cd1a8
Add doctoral thesis to type map (#3090)
Map doctoral thesis (https://www.wikidata.org/wiki/Q56462344) to type thesis in type map
2023-07-28 16:20:43 -04:00
Dan Stillman b5180b5847 RIS: Fix Citavi RIS import
An H2 tag, which Citavi seems to export, caused "entry.tags.indexOf is
not a function", probably for many years (but anyone following our
import instructions wouldn't be importing RIS).

Fixes #2884
2023-07-28 05:46:58 -04:00
Dan Stillman cc7c3c75a0 Web of Science Tagged: Fix breakage in Zotero 6
trimEnd() isn't available in Zotero 6

Regression from 80c211d1a3
2023-07-16 23:10:01 -04:00
zoe-translates 4c8a8d0a68
News Corp Australia: Scraping updates for more recent website editions (#3071) 2023-07-14 11:40:10 -04:00
Brendan O'Connell d68b0aae33
Add Perlego (#3017) 2023-07-13 15:13:56 -04:00
Dan Stillman 28f344cdb6
Merge pull request #3077 from zoe-translates/HAL-hotfixes
[HotFix] HAL: Hotfix for identification failures
2023-07-12 05:10:34 -04:00
zoe-translates edde70110f
clinicaltrials.gov: Update for new UI and enhancements (#3076)
- Make target identification and the detection of item/search work for
  both the new UI at (www.)clinicaltrials.gov and the old UI at
  classic.clinicaltrials.gov.
- Reduce network traffic significantly by eliminating the request for
  the full document when processing search results. In fact, the URL,
  which contains the NCTId, is all that's necessary for getting the
  results, and it can be scraped from the search-results page.
- Use async requests for the JSON data, which also makes the code less
  nested.
- Update and add test cases, including search page in both old and new
  UIs.
- Eliminate some dead code.
- In the routine processing JSON data, make the code less verbose.
- Other small fixes.

This resolves #3069.
2023-07-12 05:03:22 -04:00
zoe-translates 4e6d3d7d61 [HotFix] HAL: Fix abstract, PDF link, and some more type identification
- Update selector for abstract (it now has a class list with more class
  names so the previous XPath failed).
- Update the selector for PDF link.
- Cosmetic fix: further fixes to the type identification (affecting the
  Connector icon, not the actual item's metadata).
2023-07-12 16:50:50 +08:00
zoe-translates 1a1feeaf12 [HotFix] HAL: Hotfix for identification failures
The HAL translator did not work at all with the new HAL site at a
different domain.

- Update target regex for the new domain `hal.science`
- Update the element selector for the content-type label
- Do some cleaning with raw content-type label text; update some labels
- Fix a large number of ESLint errors

Resolves #3041
2023-07-12 15:31:09 +08:00
zoe-translates 80c211d1a3
WoS Tagged: Reimplement the core algorithms. (#3062) 2023-07-06 17:12:37 -04:00
Dan Stillman 9ef7130eee Fix broken imports in <6.0.26
Broken by f5b02c1df (#3059)
2023-07-06 08:36:37 -04:00
advoropaev 410138cd4a
eLibrary pages issue (#3026) 2023-07-06 02:00:30 -04:00
zoe-translates a23964050f
IPCC: Add data for AR6 WG3. (#3070)
The authorship data is based on the first pages of the book sections,
the "How to Cite" page
(https://www.ipcc.ch/report/ar6/wg3/about/how-to-cite-this-report/), and
the author list at
https://apps.ipcc.ch/report/authors/report.authors.php?q=37&p= (useful
for partitioning author first/last names).

Resolves #3061.

See also:
https://forums.zotero.org/discussion/comment/437022/#Comment_437022
2023-07-03 04:13:43 -04:00
Martijn Staal aa7d6a2b68
Add translator for Dutch newspaper NRC (#3055) 2023-07-01 23:08:03 -04:00
Dan Stillman 00413e20f5 Use `env.es2018 = true` instead of `parserOptions.ecmaVersion = 2018`
6bae3cf344 (r119545605)
2023-06-26 18:54:17 -04:00
Sebastian Karcher f5b02c1df4
Update datacite names & dataset handling (#3059)
https://forums.zotero.org/discussion/105639/bad-name-handling-when-adding-zenodo-items-by-doi#latest
2023-06-26 11:52:40 -04:00
Nux a6e270eac8
National Library of Poland ISBN search (#3036)
* filter by country code (83)
2023-06-14 22:28:41 -04:00
Sebastian Karcher 70efd04e62
NBIB: Ensure missing Extra does not break import (#3046)
https://forums.zotero.org/discussion/comment/436294#Comment_436294

* Some more nbib refinements
2023-06-14 21:49:58 -04:00
Sebastian Karcher 1e4968c524
SAGE - Fix and asyncify (#3049)
See https://forums.zotero.org/discussion/104825/zotero-connector-not-working-with-new-design-for-sage-journals#latest
2023-06-13 21:58:22 -04:00
Sebastian Karcher 8bbcfa1d65
NASA ADS: Correctly identify preprints (#3048) 2023-06-12 10:58:13 -04:00
Abe Jellinek f69ad0eb79 Web of Science Nextgen: Fix scraping with export dialog open
With the dialog open, the URL changes to something like
https://www.webofscience.com/wos/alldb/full-record/WOS:000629939000001(overlay:export/ris),
so we need to stop at the first parenthesis when extracting the ID.
2023-06-12 10:55:44 -04:00
Abe Jellinek e9a8ceacc2 Update Web of Science Nextgen SID extraction
Fixes #3050
2023-06-12 10:52:55 -04:00
Dan Stillman 6bae3cf344 Update `ecmaVersion` to 2018
Spread operator, async iteration, and some other things that were
supported in Firefox 60 (where these still have to run until Zotero 7)
2023-06-12 02:02:49 -04:00
zoe-translates 038892b593
Trove: Update API key and fix HTTP 401 Unauthorized error. (#3044)
The previous static API key is not working anymore. The current Trove
web app computes the API key using a cookie, making it vary across
sessions.

To fix this, the translator now computes the key using the same
algorithm.
2023-06-06 01:12:35 -04:00
bfahrenfort e458dc3402
Lexis+: Fix bug with word capture for "act" (#3038) 2023-05-26 00:14:14 -04:00
Sebastian Karcher ab8a83ebba
Add CFF export (#3032) 2023-05-20 14:36:41 -04:00
Sebastian Karcher 1af44d1eae
SEP update & make work for archive pages (#3034)
https://forums.zotero.org/discussion/103528/stanford-encyclopedia-of-philosophy-oddities#latest
2023-05-20 14:29:29 -04:00
Sebastian Karcher a731ec5706
Add dataset import support to RDF (#3029)
Export still todo
2023-05-20 14:14:18 -04:00
Sebastian Karcher 5556c3173b
Add Databrary Translator (#3020) 2023-05-20 13:55:57 -04:00
Sebastian Karcher bcaa8b4bef
Update DV to work properly for datasets (#3024)
* Asyncify and improve short titles

* Update regex

* use description from schema
2023-05-20 13:55:28 -04:00
Sebastian Karcher 6300365a9e
Add Dataset to RIS (#3022) 2023-05-08 14:46:46 +03:00
Brendan O'Connell 8a7b9fac0b
Fixed selector for getting abstract from page (#3033) 2023-05-04 21:14:38 -04:00
Sebastian Karcher 402c668fb3
Don't detect J-Stage PDFs (#3030) 2023-04-28 07:07:46 -04:00
Dan Stillman ecb80fad3b Lulu: Switch to HTTPS and disable ISBN search
Translator probably has to be rewritten if we still want it, but for now
don't use it for ISBN lookup.
2023-04-27 05:25:26 -04:00
Sebastian Karcher 8c803339b6
EM: Detect chaper for inbook_title (#3028) 2023-04-24 21:24:18 -04:00
Abe Jellinek 9d1a05070b CI: Upgrade dependencies 2023-04-21 12:06:27 -04:00
Stefan Ollinger 6fb3824382
dblp translator: fixes selector and some typos (#3023) 2023-04-20 12:23:06 -04:00
Sebastian Karcher ed47524212
Update Zenodo for Dataset item type (#3021) 2023-04-19 17:09:56 -04:00
Abe Jellinek 3bd1342daf MARCXML: Throw on invalid XML, skip empty records 2023-04-19 10:31:07 -04:00
Brendan O'Connell 6d165ddda0
Cambridge Core: Remove footnote links from end of title (#3018) 2023-04-18 18:44:05 -04:00
Sebastian Karcher b4829b4bfa
Add CERN Document Server (#3016) 2023-04-17 10:05:08 -04:00
Dan Stillman 618e4ed693 Restore K10plus ISBN
Closes #3019
2023-04-17 06:55:09 -04:00
Dan Stillman c878cdc1ea K10plus ISBN: Disable temporarily due to requests hanging
https://forums.zotero.org/discussion/comment/432811/#Comment_432811
2023-04-16 14:14:27 -04:00
bfahrenfort 6634110def
Add Lexis+ Translator (#3012) 2023-04-12 06:24:30 -04:00
zoe-translates 5bf94391d4
Add translator for Lapham's Quarterly (#2996) 2023-04-11 17:51:35 -04:00
Emiliano Heyns 48a7462fea
BibTex fix mark-up conversion
* fixes #3013
* use reverseMappingTable if possible
* Update tests & add new one
2023-04-09 14:55:17 -04:00
Sebastian Karcher 7f8c06b5f7
INSPIRE: Fix PDF import (#3011)
add defer to item tests. https://forums.zotero.org/discussion/comment/432186#Comment_432186
2023-04-07 04:39:25 -04:00
Abe Jellinek e6c28bf916 Newspapers.com: Support /article/ pages, improve metadata
https://forums.zotero.org/discussion/comment/432139/#Comment_432139
2023-04-05 11:26:39 -04:00
zoe-translates b3dc7f92b8
CI: Update extension button selector (#3003) 2023-04-03 15:43:37 -04:00
swifterslb 2371723bae
FAO Publications: Update for new layout (#2975) 2023-04-03 10:28:00 -04:00
Dan Stillman a55c0fecbd IMDb: Update tests 2023-03-31 18:06:17 -04:00
Dan Stillman 258c5610b4 IMDb: Fix saving after site change
Probably fixes #2999 -- I'd guess this change just rolled out first for
non-English pages
2023-03-31 18:05:37 -04:00
Maun Suang Boey 1ab84b67f6
Financial Times: Fix creators, section, URL (#3006) 2023-03-31 11:51:58 -04:00
vinothk-hw 623d3da457
Add translator for Access Engineering (#2809) 2023-03-31 11:39:34 -04:00
zoe-translates caab3d265d
NASA ADS: Handle the ampersand character (&) in BibCode. (#2998) 2023-03-31 11:16:01 -04:00
Abe Jellinek 3a9544d7b0 ACM Digital Library: Don't use DOI as URL, fix dates going in libraryCatalog 2023-03-15 22:39:33 -06:00
Dominique Moeseneder e821a276fa
CanLII: Fix court retrieval (#2994)
* Removed shims at top, update data (HTTPS links now, citation format changed)
* Switch to `text` what can be switched
2023-03-15 01:28:51 -04:00
Dan Stillman 5dcd1bc6fa DOI: Don't detect on every webpage (regression from 48a038df5)
https://forums.zotero.org/discussion/103588/doi-and-doesnt-save
2023-03-11 20:47:04 -05:00
Abe Jellinek 03b1ad4e1a CI: ESLint rule improvements
- Update prefer-index-of to walk the DOM instead of regexing - now supports --fix
- Add robust-query-selector, warns and fixes [id="abc"] and [class="abc"] selectors
2023-03-10 12:33:06 -05:00
Abe Jellinek 32aa378f50 CI: Tell ESLint that we're in a browser environment
Should no longer complain about the `URL` global.
2023-03-10 11:23:02 -05:00
Abe Jellinek 48a038df5c
DOI: Pull DOIs from URL (#2967) 2023-03-10 11:20:15 -05:00
zoe-translates f3b8dfd098
CNKI: Replace obsolete method of article-info retrieval. (#2990)
- The old method based on the "zwjdown" class is removed, because the
  class is no longer present in the document.
- It is replaced by the method using hidden input fields in the sequence
  of attempts, after the URL-based one.
- As a backup, a new method based on the note-taking button is added
  after that.
2023-03-08 16:34:54 -05:00
kevin820606 85f3b74b6b
Airiti: Fix Chinese name splitting (#2977) 2023-03-07 10:43:15 -05:00
Brendan O'Connell b2a71d2833
IMDb: Fix scraping error from JSON with apostrophes (#2989) 2023-03-07 10:35:37 -05:00
Brendan O'Connell d8699c6fb8
Add Standard Ebooks (#2981) 2023-03-07 10:24:20 -05:00
Linxzh e271424ef4
Update CNKI refworks output post method (#2987) 2023-03-04 01:09:48 -05:00
Sebastian Karcher 8a6fad9a31
Fix multiples in IEEE (#2986)
https://forums.zotero.org/discussion/103337/issue-with-zotero-connector-on-chrome#latest
2023-03-02 14:26:36 -05:00
Sebastian Karcher d709f11e32
Fix chapters for some Springer Books (#2984)
https://forums.zotero.org/discussion/103278/edited-book-with-chapters-by-different-authors#latest
2023-02-27 11:45:36 -05:00
Sebastian Karcher 8238cd53ec
CNKI:fix parsing of db and file info from item pages (#2978)
Add some tests
2023-02-21 22:54:17 -05:00
Sebastian Karcher 43bc505435
Add EBSCO DIscovery Layer (#2974)
Seems to work pretty well. Could likely use some fine tuning, but the basics are there
2023-02-13 22:32:03 -05:00
Abe Jellinek 2c2e190ca5 Copernicus: Update for current site
Fixes #2947
2023-01-25 11:00:48 -05:00
Abe Jellinek b825a175c2
EM: Fall back to `<time>` in `addLowQualityMetadata()` (#2968) 2023-01-24 12:43:10 -05:00
Abe Jellinek 3f1a3b5229 Rechtspraak.nl: Update for new site
Fixes #2965
2023-01-18 13:21:33 -05:00
Abe Jellinek 23aa650ec2 YouTube: Support mobile site
Fixes #2948
2023-01-17 14:12:06 -05:00
Abe Jellinek ff3857d2c3 Wiley: Work around missing title in BibTeX
Fixes #2963
2023-01-17 13:34:47 -05:00
Abe Jellinek 975b6a65b5 US National Archives Research Catalog: Update for new API
We could certainly make this better, but it'll do for the time being.
2023-01-17 13:26:29 -05:00
Sebastian Karcher 3baec8a3ef
Fix WSJ: JSON-LD changed (#2960) 2023-01-17 10:59:38 -05:00
Sebastian Karcher 6b26b7a84f
Fix and update Microbiol. Soc. Journals (#2962) 2023-01-17 10:58:47 -05:00
YFdyh000 666dd23b35
Wikipedia: Don't capture history page (#2952) 2023-01-17 10:57:35 -05:00
Sebastian Karcher b875960061
Update Dialnet (#2953) 2023-01-17 10:55:53 -05:00
Dan Stillman 7090858945
Crossref Unixref XML: Don't fail on control characters in data (#2959)
https://forums.zotero.org/discussion/102271/lookup-failed-for-doi
2023-01-12 21:09:21 -05:00
Sebastian Karcher f158ec6c6f
HotFix for missing import from PubMed collections & clipboard (#2958) 2023-01-10 09:12:13 -05:00
YFdyh000 d89c17061e
Wikipedia Citation Templates: Fix `undefined` creators, lint (#2954)
Co-authored-by: Sebastian Karcher <karcher@u.northwestern.edu>
2023-01-04 16:41:10 -05:00
Sebastian Karcher 8ed0f642e2
Add Korean National Library (#2924) 2022-12-27 21:11:04 -08:00
Sebastian Karcher 7370347d63
Fix and update REDALYC (#2946) 2022-12-27 09:33:17 -08:00
Anders Johan Jamtli fc2a1caf28
Amazon: Update for new layout and updating tests (#2942)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2022-12-20 12:24:36 -05:00
Abe Jellinek 675350c557 CI: Upgrade to the latest ESLint for modern JS support
Make sure you're using Node >= 16 and run `npm install` before
attempting to lint a translator.
2022-12-16 13:51:33 -05:00
Abe Jellinek 293499861d ProQuest: Improve support for non-English locales
- Better initial selector for the language name
- Remove LTR marker from language label
- Fix detection failing when type name on page is localized

https://forums.zotero.org/discussion/101791/cant-save-paper-from-proquest-only-proquest
2022-12-15 10:37:45 -05:00
Abe Jellinek e32fe0370a Springer Link: Fix Full Book title scraping 2022-12-15 09:55:29 -05:00
Abe Jellinek 4dc160507a FreePatentsOnline: Fix PDFs and support viewer page
https://forums.zotero.org/discussion/101715/how-to-get-the-redirected-link-of-pdf-freepatentonline-com
2022-12-13 12:39:43 -05:00
Abe Jellinek 417230792c NAP and TRB: Support new NAP site and TRB TRID database
Fixes #2938
2022-12-12 15:12:00 -05:00
Abe Jellinek 34476a525a HAL Archives Ouvertes: Import posters as presentations
Fixes #2935
2022-12-12 14:30:45 -05:00
Futurer 463c2818b2
Added language Label support in Wikidata QuickStatements (#2943) 2022-12-09 13:51:58 -05:00
yensung a609b07ccb
Fix Semantic Scholar Web Translator (#2914) 2022-12-09 13:45:09 -05:00
Sebastian Karcher 8c879aef7a
Add Mastodon translator (#2939) 2022-12-09 11:36:33 -05:00
Sebastian Karcher a60935d266
Add Cambridge Engage Preprints (#2945) 2022-12-08 15:52:16 -05:00
Sebastian Karcher 7673962afa
Project MUSE: Update Target (#2944) 2022-12-08 11:54:18 -05:00
Sebastian Karcher 2509d80105
Optica: Don't fail when PDF link goes straight to PDF (#2932) 2022-12-08 11:44:45 -05:00
Abe Jellinek 65ab6eb2fb .eslintrc: Set ES version to 2017
We can bump this even higher once Zotero 7 is out.

https://github.com/zotero/translators/pull/2932#issue-1460210387
2022-12-08 11:43:27 -05:00
Abe Jellinek a2fc3b4bfd
EM: Don't save a snapshot if we save a PDF (#2878) 2022-12-08 11:39:18 -05:00
YFdyh000 b0163733eb
Don't capture Special Pages on MediaWiki sites (#2940) 2022-12-08 11:31:46 -05:00
Abe Jellinek ce4979ee9b WHO ISBN search: Filter by the ISBN field
https://forums.zotero.org/discussion/101558/magic-wand-isbn-imports-arbitrary-items
2022-12-06 13:21:48 +01:00
Sebastian Karcher 493e3c22be
Fix WorldCat Discovery Layer (#2933)
https://forums.zotero.org/discussion/101353/keep-getting-an-error-trying-to-add-references#latest
2022-11-28 12:15:41 -05:00
Abe Jellinek a23bf8040a
EM: Skip adjacent repeated authors (for Optica) (#2931) 2022-11-21 23:03:41 -05:00
Abe Jellinek 698cb399d0 WorldCat Discovery: Fix availability link appearing in multiples
Fixes #2923
2022-11-16 17:16:09 -05:00
Lennart Braun 551f7d5a04
ePrint: Get authors from <meta> tags (#2926)
Fixes #2913
2022-11-16 17:11:23 -05:00
Guy Aglionby 9c4c208a88
Add missing mimetypes for ACLWeb (#2922) 2022-11-14 11:59:26 -05:00
Sebastian Karcher 6d78935701
Add CCHL-Portal (#2920) 2022-11-14 11:59:01 -05:00
Sebastian Karcher 1509270771
Rewrite of Foreign Affairs (#2918) 2022-11-14 11:58:21 -05:00
Abe Jellinek ac3936c799
ERIC: Add search (#2916) 2022-11-14 11:56:44 -05:00
Abe Jellinek 098d562e61 SAGE Knowledge: Fix multiples 2022-11-11 09:55:03 -05:00
Abe Jellinek 8c9da9b034
APA PsycNet: Fix search result detail pages & multiples (#2915) 2022-11-09 16:12:08 -05:00
Sebastian Karcher 00f682d617
Update Scopus for new interface (#2921) 2022-11-09 16:03:53 -05:00
Abe Jellinek 23b2f42584 Open WorldCat: Fully fix detection
__NEXT_DATA__ won't change when navigating to a /title/ page from a
search, so just fall back to 'book' when we can't find an item type.

Fixes #2912
2022-11-01 15:41:08 -04:00
Abe Jellinek d2ea0da039 WaPo: Fix authors and date
Fixes #2880
2022-11-01 15:26:03 -04:00
Dan Stillman 0d26b12641 BibTeX: Fix error if passed options without `exportCharset`
Fixes an error in the client tests

Regression from 76146e54dd
2022-10-31 19:11:13 -04:00
Sebastian Karcher 5b1c15a63e
Add Duke University Press Books (#2899) 2022-10-31 15:36:50 -04:00
Sebastian Karcher 0d7243f1ce
Some MODS improvements for govinfo (#2907) 2022-10-31 10:38:51 -04:00
Jack Yu a20d753066
Add new cnki dbname and name extraction method (#2903) 2022-10-31 10:37:46 -04:00
Sebastian Karcher 54eb4d65f9
Add translator for Harvard UP Books (#2900) 2022-10-31 10:36:54 -04:00
Dan Stillman 76146e54dd BibTeX: Don't escape characters if "UTF-8 without BOM" is selected
https://forums.zotero.org/discussion/comment/85557/#Comment_85557

This has apparently been broken for over a decade. The default "UTF-8"
option also isn't actually including a BOM, so we'll have to decide what
to do about that, but we can deal with that separately.
2022-10-31 00:48:24 -04:00
Abe Jellinek b337cd542a Scopus: Add 500 ms delay between requests
Fixes #2908
2022-10-28 11:25:53 -04:00
wolf c02d66edfc
Le Maitron: Add multi-author support (#2888) 2022-10-28 11:10:10 -04:00
Jack Yu 48d68cc6cc
Fix CNKI translator test cases (#2902) 2022-10-28 11:08:01 -04:00
Sebastian Karcher 65161a4967
OUP: Lint, add authors from DOM if necessary (#2898) 2022-10-28 11:07:30 -04:00
Abe Jellinek 9ee6337533 govinfo: Detect using URL
https://forums.zotero.org/discussion/100392/govinfo-translator
2022-10-28 10:47:52 -04:00
Abe Jellinek a23df534c7 MODS: Support US gov bill extensions
Further work on https://forums.zotero.org/discussion/100392/govinfo-translator
2022-10-28 10:40:06 -04:00
Abe Jellinek 48a56d33dc MODS: Fix error when hearing lacks chamber
https://forums.zotero.org/discussion/100392/govinfo-translator
2022-10-28 10:18:28 -04:00
Abe Jellinek 8ccc22ecfe Open WorldCat: Call monitorDOMChanges()
Fixes #2912
2022-10-27 17:07:50 -04:00
Dan Stillman c24909a806 Update Note HTML timestamp
Now blocked from being pushed to clients before 6.0.16-beta.7, but this
will allow local updating to work more reliably
2022-10-26 06:47:23 -04:00
Sebastian Karcher ee719757f7
Add abstract to various additional Atypon Sites (#2911)
Addresses https://forums.zotero.org/discussion/100405/science-pnas-translators-not-pulling-in-abstract-field#latest
2022-10-24 23:38:13 -04:00
Martynas Bagdonas 37a8ce41f5
Note HTML: Add an option to include annotation and citations links (#2844) 2022-10-22 16:34:04 -04:00
Sebastian Karcher 3c36088528
Fix Case Report import (#2910)
Reported: https://forums.zotero.org/discussion/100348/solved-nbib-import-journal-articles-imported-as-reports/p1
2022-10-19 22:45:25 -04:00
Dan Stillman ac9df4fb55 Open WorldCat: Hyphenate ISBNs to avoid long lookup delays
Currently unhyphenated ISBNs seem to trigger unindexed lookups on
WorldCat's end, with requests taking 40+ seconds, so hyphenate them
before sending.

Unfortunately `hyphenateISBN()` is in `Utilities.Internal`, and the ISBN
range data it uses is in another file, so this copies those into the
translator for now.
2022-10-19 00:41:29 -04:00
Abe Jellinek dfd3a8f56d Open WorldCat: Use Cookie header for authentication 2022-10-18 16:37:03 -04:00
Lars Toenning 2f2927e567
BibLaTex: Add newline at end of last line (#2906) 2022-10-12 14:07:07 -04:00
Sebastian Karcher b9498d0ecb
ERIC/nbib: Add ERIC ID & other improvements (#2904) 2022-10-11 12:39:39 -04:00
Abe Jellinek 4bad0c02e8 OSA: Update for new URL, new PDF embed page
https://forums.zotero.org/discussion/comment/419096/#Comment_419096
2022-10-07 13:40:40 -04:00
Abe Jellinek 3f9221ef28 Substack: Fix /comments pages without JSON-LD
Fixes #2889
2022-10-05 11:16:54 -04:00
Niko Savola d513d3a1fb
Fix typo in FreePatentsOnline attachment (#2895) 2022-10-04 04:04:30 -04:00
Sebastian Karcher d461173347
Fix EV for new records page (#2896)
Reported: https://forums.zotero.org/discussion/100118/compendex-engineering-village-records-import-as-web-pages#latest
2022-10-04 01:17:17 -04:00
Abe Jellinek c6ee94369c WorldCat: Fetch build ID instead of hardcoding 2022-10-01 15:36:40 -04:00
Abe Jellinek b95b964ae9
WorldCat: Fix 403 with hardcoded build ID (#2894) 2022-10-01 15:07:29 -04:00
Sebastian Karcher 985c56f03d
Fix all caps titles & authors in JSTOR (#2876) 2022-10-01 14:05:18 -04:00
Sebastian Karcher 8afa023398
Add some more thesis terms to DC.type in RDF (#2886) 2022-10-01 14:03:29 -04:00
Dan Stillman 3c3416b19b
Merge pull request #2893 from igravious/patch-1
Update Clinical Key.js
2022-10-01 03:06:55 -04:00
igravious 9be20256b9
Update Clinical Key.js
Add a newline `\n` after the metadata block to make `Clinical Key.js` compatible with every other translator.
2022-10-01 07:31:23 +01:00
Dan Stillman 3da7ed0467 Bibliontology RDF and TEI: Skip standalone notes
This fixes an error if trying to export a collection or multiple items
containing a standalone note.

https://forums.zotero.org/discussion/100000/bug-bibliontology-rdf-fails-on-standalone-note
2022-09-30 06:59:32 -04:00
Abe Jellinek caef8845a0 Open WorldCat: Also send referer when fetching ISBNs 2022-09-28 22:25:17 -04:00
Abe Jellinek 7b27a8db31 Open WorldCat: Potentially fix 401 2022-09-28 21:56:56 -04:00
Sebastian Karcher 6538b03fa3
Fix CSL JSON import for new CSL types (#2885) 2022-09-20 12:51:09 -06:00
Abe Jellinek 0259500dff Atypon: Add missing slash in /epdf/
https://forums.zotero.org/discussion/comment/416724/#Comment_416724
2022-09-08 15:35:08 -06:00
Abe Jellinek 73bd3b73e7 Atypon: Fix embedded reader PDFs, empty author list
https://forums.zotero.org/discussion/99578/citation-not-downloading-correctly
2022-09-07 11:45:12 -04:00
Abe Jellinek 5a3169cdce Open WorldCat: Bump timestamp
Some forum users report not getting the update, so this pushes it out
again, just to be sure.
2022-08-31 20:01:02 -04:00
Abe Jellinek 5e906e729e Add translator for Preprints.org
https://forums.zotero.org/discussion/99422/zotero-connector-adding-support-for-preprints-org-mdpi
2022-08-31 10:36:38 -04:00
Abe Jellinek 73e4439e56 Open WorldCat: Remove unnecessary reload hack
Was necessary with processDocuments(), not necessary with
requestDocument().
2022-08-29 18:09:51 -04:00
Abe Jellinek efac05b4eb Open WorldCat: Reload from server if __NEXT_DATA__ is stale
https://forums.zotero.org/discussion/comment/415957/#Comment_415957
2022-08-29 17:19:05 -04:00
Dan Stillman c0b471ef4c Open WorldCat: Fix entries with only firstName field
https://forums.zotero.org/discussion/comment/415585/#Comment_415585
2022-08-28 23:57:22 +02:00
Dan Stillman bda4f70aeb Update Note Markdown
Update to zotero/markdown-translator-builder@ac2d9f350

https://github.com/zotero/zotero/issues/2343#issuecomment-1228203518
2022-08-26 04:51:35 -04:00
Dan Stillman 77e990536b DataCite JSON: Fix parsing of literal name strings
Interpret as "Family, Given"

https://forums.zotero.org/discussion/99300/import-with-datacite-doi-wrong-order-of-autor-name-given-family
2022-08-25 06:27:11 -04:00
Dan Stillman a51777e792 Update Note Markdown
Update to zotero/markdown-translator-builder@7843801
2022-08-25 04:12:30 -04:00
Sebastian Karcher 130493d11f
Support Author Profiles on HeinOnline (#2867) 2022-08-24 12:04:38 -04:00
Abe Jellinek f5e2d3d022
Open WorldCat: Update for new site (#2870) 2022-08-23 17:17:58 -04:00
Sebastian Karcher 05442b784b
Silverchair: One more URL format (#2869) 2022-08-23 14:24:11 -04:00
Sebastian Karcher fce44d382f
Silverchair: Add chapters (#2863) 2022-08-22 13:49:33 -04:00
Sebastian Karcher 27894bcb50
Add El Comercio (Peru) (#2864) 2022-08-22 11:56:19 -04:00
Dan Stillman 4207a8967d
Merge pull request #2860 from tnajdek/citavi-async
Citavi 5/6 translator improvements
2022-08-19 11:53:00 -04:00
Tom Najdek 1509b83ff5
Citavi: lint 2022-08-18 17:33:10 +02:00
Tom Najdek cbb1763d1f
Citavi: Add progress feedback 2022-08-18 16:16:54 +02:00
Tom Najdek c9866c8a22
Citavi: Fix numbering for nested categories
Previous approach did not work for files where categories appeared
out-of-order in the source document.
2022-08-18 00:30:28 +02:00
Tom Najdek 3ce538778b
Citavi: recreate collections hierarchy 2022-08-18 00:30:28 +02:00
Tom Najdek 746df88fb0
Convert Citavi translator to async
Also lint code.
2022-08-18 00:30:28 +02:00
Tom Najdek 6a85edb268
Add read() and getXML() API defs 2022-08-18 00:30:28 +02:00
Abe Jellinek 4c38bbdf5f Typing: Deprecate callback HTTP methods
So Scaffold shows them crossed out.
2022-08-17 16:36:20 -04:00
Matt Teichman e288c319bf
Add translator for University of Chicago VuFind (#2846) 2022-08-17 16:17:33 -04:00
Abe Jellinek 8e0e147e46 Springer Link: Fix book detection
https://forums.zotero.org/discussion/99042/zotero-connector-import-a-book-from-springer
2022-08-15 15:51:20 -04:00
Abe Jellinek 59a7045d36 ePrint IACR: Update for current site + preprint type
https://forums.zotero.org/discussion/99050/translator-update-request-change-iacr-cryptology-eprint-archive-translator-to-use-preprint-type
2022-08-15 15:16:32 -04:00
Sebastian Karcher c940ceb609
Fix PDFs in PMC (#2859)
See https://forums.zotero.org/discussion/comment/414662/#Comment_414662
2022-08-12 10:23:32 +02:00
Tim Sherratt cd5e1c91a5
NLA: Save URLs for digitised items (#2856) 2022-08-08 14:23:18 -04:00
Cesaryuan 5b4fb4621a
Ariti: Match URL case-insensitively (#2855) 2022-08-08 14:22:13 -04:00
aGolduck c9a2935e87
Typing: Fix HTTPRequestParameters field name (#2858) 2022-08-08 14:20:28 -04:00
Abe Jellinek 3ecd7b22e0 Semantic Scholar: Support multiples 2022-08-08 14:15:09 -04:00
Abe Jellinek 8dd9dbe592 Fix Substack
json.author can be an array now.

Fixes #2854
2022-08-08 11:57:45 -04:00
Sebastian Karcher 8fa26f41aa
Fix Annual Reivew alt URL schema (#2857) 2022-08-04 23:10:37 +02:00
Dan Stillman 352ef8a5a7 IPCC: Retrigger push due to server issue 2022-08-03 18:06:37 -04:00
Abe Jellinek 52ddf92288 IPCC: Update links & selectItems() keys, remove supp. material
No underscore = newer draft.

Supplementary material is no longer listed on the site, only in archived
draft pages.
2022-08-03 12:31:15 -04:00
Abe Jellinek 1f1c7f3e30 IPCC: Add more metadata to WG1
Closes #2845
2022-07-26 13:11:09 -04:00
Abe Jellinek 75eb338759 CI: Don't process.exit() if outputting JSON
We don't want the exit code anyway, and this sometimes prevents the
stdout buffer from being fully flushed.
2022-07-19 16:18:22 -04:00
Abe Jellinek 1607f5be2e CI: Allow outputting JSON to stdout 2022-07-19 15:55:51 -04:00
Abe Jellinek c3c99582e2 T&F+NEJM: Don't save snapshots
https://forums.zotero.org/discussion/98468/enhancement-do-not-save-snapshot-for-tandfonline-com-journals
2022-07-19 11:28:51 -04:00
Abe Jellinek 62969db2cf JSTOR: Fix multiples again
Results are now wrapped in custom elements, making it a bit harder to
pull out the title and URL.

https://github.com/zotero/translators/issues/2822#issuecomment-1185363624
2022-07-15 10:04:27 -04:00
Abe Jellinek 5d5c79bd5e Bookmarks: Include tags in export
Closes #2820
2022-07-14 16:23:18 -04:00
Abe Jellinek 67019f8264 Add La República (Peru)
Closes #2841
2022-07-14 14:51:25 -04:00
Abe Jellinek 9e02c3550e CI: Skip executable check on Windows
Fixes #2850
2022-07-14 13:06:47 -04:00
Sebastian Karcher 7e2e1fdc12
RIS: Fail gracefully on 0000 in date field (#2851) 2022-07-14 12:41:27 -04:00
Abe Jellinek 75794a742e Fix Taylor & Francis eBooks book sections
https://forums.zotero.org/discussion/98367/taylor-and-francis-saving-problem
2022-07-13 14:42:25 -04:00
Tim Sherratt e3b6326dfd
Add Libraries Tasmania translator (#2832) 2022-07-13 12:22:48 -04:00
Dan Stillman 0dca2d83ec IngentaConnect: Fix PDF downloads
The IC.identifier meta tag no longer contains the full identifier needed
for downloads, so use the download button directly or construct from the
main URL.

https://forums.zotero.org/discussion/97740/ingentaconnect-pdf-not-downloaded
2022-07-12 01:41:39 -04:00
Sebastian Karcher 0367773e17
Fixes regression introduces in #2847 (#2848) 2022-07-10 13:10:15 -04:00
Sebastian Karcher 541ccea859
Fix Proquest (#2847)
Closes #2839
Addresses error reported at https://forums.zotero.org/discussion/comment/411799#Comment_411799
2022-07-08 10:46:18 -04:00
Abe Jellinek cf3b2622eb IPCC: Add publisher to WG2 2022-06-30 09:33:28 -04:00
Abe Jellinek bfc5202684 IPCC: Add support for WG2
Fixes #2842
2022-06-29 20:55:56 -04:00
Dan Stillman b6f906004a CSV: Fix regressions after 21819b8bbd
Revert to legacy mode, which includes base-mapped fields in
`uniqueFields`. In non-legacy mode, we don't seem to have any access to
base field mappings (hence the bad hard-coded mappings in, e.g., EndNote
XML). We'll need to add a way to get base fields for the export
translators that need it.

Also:

- Fix how tag types are handled so tags don't break when we do update
  from legacy mode

Fixes #2843
2022-06-28 15:49:09 -04:00
Dan Stillman c6606ec521 Silverchair: Avoid error in console on non-Silverchair pages
Since the `target` isn't site-specific, `detectWeb()` shouldn't throw an
error if an article id can't be found.

E.g., https://www.sciencedirect.com/science/article/pii/S0048969720355285
2022-06-24 19:09:08 -04:00
Dan Stillman 56fde4773b CSV: Lint 2022-06-24 17:46:57 -04:00
Dan Stillman 21819b8bbd CSV: Fix `key` value when run from API
https://forums.zotero.org/discussion/comment/407148/#Comment_407148
2022-06-24 17:46:48 -04:00
Estelle 151e9fb702
RIS - Thesis : add contributor field (#2833)
RIS add contributor field on A3 for thesis
2022-06-17 10:27:24 -04:00
Abe Jellinek 644e08a4c0 APA PsycNET: Support doi. subdomain
Fixes #2831
2022-06-16 18:24:40 -05:00
Christopher Johnstone 77320a88cb
Update HighWire2 importer to correctly set preprint type on biorXiv/medrXiv items (#2834)
Updated the hardcoded itemtype in detectWeb for biorXiv
and medrXiv to be the "preprint" type. The previously-hardcoded
"report" type overrode the checks performed in addEmbMeta.
Fixes the otherwise-failing medrXiv and biorXiv test.

- Return preprintType to ensure translation on Zotero <6 functions
2022-06-14 12:33:21 -04:00
Dan Stillman ee6171061c K10plus ISBN: Force PDF ToC URLs to HTTPS
www.gbv.de and d-nb.info support HTTPS, and I'm guessing any other
domains specified in MARC records do too. This is necessary for PDF
downloads to work for Add by Identifier on iOS and is just generally a
good thing to do. If we find specific domains that don't work we can add
exceptions for those.
2022-06-10 02:37:40 -04:00
Dan Stillman 2298810bda Open WorldCat: Switch to HTTPS for ISBN lookups 2022-06-10 02:12:09 -04:00
Sebastian Karcher bbe5ac5173
Beobachter - rewrite (#2777)
Closes https://github.com/zotero/translators/issues/2486

I got rid of the issue/volume designation as this looks like it's almost 
entirely online, with no sign of published issues on the online articles
2022-06-04 14:55:42 -04:00
Sebastian Karcher 5a52ddbe52
Mostly re-write CAIRN (#2829)
Now using RIS
https://forums.zotero.org/discussion/97508/wrong-data-from-https-www-cairn-info#latest
2022-06-04 14:26:54 -04:00
Sebastian Karcher 056195ff97
Fix UW Madison catalog (#2828) 2022-05-31 09:52:23 -04:00
Abe Jellinek 32f2271bf0
Add translator for Mikromarc (#2794) 2022-05-12 13:49:53 -07:00
Sebastian Karcher 8cbc08b22c
Switch arXiv to report / article (#2790) 2022-05-12 13:05:37 -07:00
mmoole b6ab036360
Dart-Europe: .eu -> .org (#2821) 2022-05-11 14:39:31 -07:00
Abe Jellinek 93f8b984b5 Primo 2018: Support collections
Finally. Fixes #2012.
2022-05-11 14:32:47 -07:00
Abe Jellinek c2ee846206 Add translator for Wilson Center Digital Archive
Some metadata is inappropriately put in Archive Location but can't
effectively be parsed by the script.

Fixes #2748
2022-05-11 14:20:31 -07:00
Abe Jellinek c95c9dc212 Airiti: Fix web, disable search for now
Fixes #2754.

The site now loads an extra page to set a cookie that the citation export
endpoint then checks. Not a problem for web translation, but search
doesn't seem to handle the cookies correctly.
2022-05-10 17:57:19 -07:00
Abe Jellinek 9d3c139dac JSTOR: Fix multiples
https://forums.zotero.org/discussion/97095/jstor-folder-icon
2022-05-10 15:26:53 -07:00
Abe Jellinek afda9810f8 Atypon: More fixes, support whole books 2022-05-10 11:26:57 -07:00
Abe Jellinek b329b9109a Atypon: Scrape date from HTML if not in RIS
https://forums.zotero.org/discussion/comment/400385/#Comment_400385
2022-05-10 10:25:24 -07:00
Abe Jellinek a0a5003111 Add initial translator for RERO ILS
https://forums.zotero.org/discussion/96851/extension-doesnt-recognize-books-with-rero-ils-catalogue
2022-05-09 11:20:45 -07:00
Abe Jellinek a41195e2f8 Further improve type inference in Scaffold
Using a generic constructor instead of overloads allows inference to
work with union types - if the type checker can infer that the `itemType`
you're passing is either 'preprint' or 'report', for instance, it will
return a union between PreprintItem and ReportItem instead of a
generic Item.
2022-05-03 18:06:59 -07:00
Abe Jellinek 35f0ff1d22 LingBuzz: Update tests 2022-05-03 18:01:05 -07:00
Abe Jellinek f581584006 LingBuzz: Save "Published In"
Closes #2797
2022-05-03 17:59:37 -07:00
Dan Stillman 01fa697837 Note Markdown: Custom corrections for some annoying escapes
From zotero/markdown-translator-builder#a18a9a5f3
2022-05-02 02:59:10 -04:00
Jonas Sk 1bc64bd22d
Add translator for ECHR HUDOC (#2149) 2022-04-29 14:57:18 -07:00
Abe Jellinek e7b84fe29b Merge branch 'add-vam-translator' 2022-04-29 12:24:07 -07:00
Abe Jellinek dcd564f7d4 Fix tests, improve Archive scraping, normalize Jr./Sr. 2022-04-29 12:20:25 -07:00
JLueke 58eccd7c99
Der Freitag: Update, remove FW (#2812) 2022-04-29 11:48:26 -07:00
Abe Jellinek 84527de4a4 Add translator for Elicit
Closes #2818. No test cases because URL doesn't change.
Multiples disabled for now.
2022-04-28 14:20:16 -07:00
Abe Jellinek 2fd7e723f2 CI: Log on missing file
Not going to make this a fatal error in case something depends on the
old behavior. Feedback in the log is still an improvement.
2022-04-25 09:43:51 -07:00
Abe Jellinek 0d24f61f6c CI: Fix failing Git fetch 2022-04-22 14:16:06 -07:00
Sebastian Karcher 7cde4de13e
Add support for all DBs in WoS (#2817)
Closes #2815
2022-04-22 13:58:57 -07:00
Abe Jellinek 18070c3ca8 LingBuzz: Support alternate domain, fix detection 2022-04-22 13:10:03 -07:00
Abe Jellinek 97f6c5466f LingBuzz: Use preprint when available
Fixes #2798.
2022-04-22 13:06:49 -07:00
Abe Jellinek 6541b91bc6 APA PsycNET: Support DOI landing pages
Fixes #2814
2022-04-22 12:56:42 -07:00
Abe Jellinek 3c1b1f2c63 Springer Link: Various improvements
Support full books, update for site changes, give PDF standard title.

https://forums.zotero.org/discussion/comment/405082/#Comment_405082
2022-04-11 14:29:28 -07:00
Abe Jellinek 0dadeb76d2 Open WorldCat: Fix out-of-order search results
Not only do number-type object keys get sorted numerically instead of by
insertion order, but string-type keys that *could* be numbers do too.
That's neat.

Fixes #1604.
2022-04-08 09:41:43 -07:00
Dan Stillman 35f09ebb28 Note Markdown: Avoid extra spaces in Markdown note export
From zotero/markdown-translator-builder#ce667df4
2022-04-07 03:33:25 -04:00
Abe Jellinek d481264765 Fix NZZ.ch
https://forums.zotero.org/discussion/96076/nzz-ch-translator-not-working-as-intended
2022-04-05 10:24:14 -07:00
Abe Jellinek ba3cec3ff7 Use `preprint` in NBER, SSRN, OSF Preprints, & HW 2.0
Fixes #2808
2022-04-04 11:39:16 -07:00
Benjamin Altpeter 38d73484ec
Add two missing Stack Exchange sites (#2811) 2022-04-04 11:09:34 -07:00
Richard Palmer d9f57477b6 Adding Victoria & Albert museum collection translator 2022-04-03 17:18:33 +01:00
Dan Stillman 7d8878c280 Frontiers: Update timestamp to trigger re-push 2022-04-02 15:37:04 -04:00
Abe Jellinek 67f768da75 Ignore .DS_Store 2022-03-30 12:15:55 -07:00
Abe Jellinek 380c4aebcf Fix Frontiers on pages without citation link 2022-03-30 12:11:07 -07:00
Abe Jellinek 8ea05e0596 Add translator for Stack Exchange sites
Fixes #2805
2022-03-28 12:01:51 -07:00
Sebastian Karcher 07d6d828f8
Update NIPS for 2020-22 (#2804) 2022-03-28 18:02:34 +00:00
Abe Jellinek 4929cbf7fa Typing: Add preprint
Closes zotero/zotero#2481
2022-03-28 10:39:53 -07:00
Abe Jellinek b84fb3290c Translate tweets as forum posts 2022-03-25 13:45:51 -07:00
Dan Stillman d37788c945 Note Markdown: Fix item key for unsynced libraries
From zotero/markdown-translator-builder#3144e2b5fc
2022-03-21 06:02:35 -04:00
Martynas Bagdonas b18eeac0f7
Note HTML: Add missing charset meta (#2799) 2022-03-16 06:06:47 -04:00
Abe Jellinek cb1d062bf6 BibLaTeX: Strip {}
Fix copied from BibTeX translator. Fixes #2796.
2022-03-09 09:42:26 -08:00
dependabot[bot] 7a0f7ac3e3 Bump ajv from 6.10.0 to 6.12.6
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.10.0 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.10.0...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 19:19:50 +00:00
dependabot[bot] 375e8f0c85 Bump follow-redirects from 1.14.7 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-08 19:19:42 +00:00
Abe Jellinek 7016d768ac
RIS: Output ISO dates (#2779) 2022-03-08 19:17:23 +00:00
Sebastian Karcher c6595f79d7
HotFix - FreePatentsOnline (#2795) 2022-03-08 18:17:39 +00:00
Abe Jellinek 96bfe4a45c IMDb: Fix improper use of `castMember` on films
Fixes #2793
2022-03-07 17:00:44 -08:00
Abe Jellinek 1848499d15 Atypon: Support new PNAS site
Fixes #2791
2022-03-04 18:26:32 -08:00
Abe Jellinek a8fe412a64 Support tags and Attachment.path 2022-03-04 17:14:23 -08:00
Abe Jellinek 9d3c8688ea CI: Add JSON output 2022-03-02 15:06:05 -08:00
Abe Jellinek 5ccdaa5053 Fix Google Scholar case detection 2022-02-24 17:19:59 -08:00
George Gebbett 8af1a08fa8
nbib - Get page number from LID field when no PG field exists (#2786)
* If there is no PG field in the nbib, use the PII info from the LID field, as per the PubMed XML translator

* Add test for items where page number is extracted from LID field

* Remove pagesBackup field in finalize function

Closes #2783
2022-02-21 13:27:19 -05:00
George Gebbett 827898b47a
Fix WestLaw case title scraping (#2784)
* Add fallback to page title if case name element is not present on page
2022-02-14 06:25:16 -05:00
Sebastian Karcher 3db541be41
Fix Atypon for Science (#2782) 2022-02-08 12:11:06 -08:00
Abe Jellinek 665af8a57b Atypon Journals: Fix dates
Fixes #980
2022-02-08 11:05:36 -08:00
Abe Jellinek c18432db20 Fix KitapYurdu.com
https://forums.zotero.org/discussion/comment/398920/#Comment_398920
2022-02-08 10:18:57 -08:00
Dan Stillman d16b803668 Library of Congress ISBN: Re-enable in Zotero Connector 2022-02-07 13:33:30 -05:00
Dan Stillman 5d422e76a9 Library of Congress ISBN: Temporarily disable in Zotero Connector
lx2.loc.gov:210 is currently down, and due to a bug in the translation
framework, that's causing all ISBN-based saves in the Zotero Connector
to hang. For now, skip LoC until the service is back up.

https://forums.zotero.org/discussion/94327/zot-connector-issues
2022-02-06 06:47:58 -05:00
George Gebbett 698aac8d79
Add translator for Westlaw (#2309) 2022-02-03 16:11:44 -08:00
Abe Jellinek fd66f6c799 PNX: Preserve dots in publisher, remove NLR metadata
https://forums.zotero.org/discussion/94260/primo-2018-translator-eats-dots-and-spaces-in-the-publisher-field
2022-02-02 11:34:34 -08:00
Abe Jellinek 201520d852
Merge pull request #2772 from zotero/dependabot/npm_and_yarn/follow-redirects-1.14.7
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-01 23:02:41 +03:00
Robert Sim f8ec1fab09
Fix Straits Times (#2775) 2022-02-01 12:00:52 -08:00
Abe Jellinek dba91cd5d7 CI: Update Node to fix pull request checks 2022-02-01 11:52:18 -08:00
Sebastian Karcher 5fb550e716 Google Scholar: Lint 2022-02-01 21:47:31 +03:00
Sebastian Karcher 5f0e995924 Google Scholar: Fix profiles 2022-02-01 21:47:31 +03:00
Sebastian Karcher 8f09b9a6dc
MDPI - add ISSN, unescape HTML (#2776)
closes #2767 
addresses 
https://forums.zotero.org/discussion/94072/request-for-modification-of-translator-for-mdpi-journals
2022-01-25 05:00:17 -05:00
Rene Wiermer fd6ce4989c
Update Delpher for new site, add PDF/image support (#2769)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2022-01-21 23:18:26 +03:00
Abe Jellinek 64bbfdca9f HighWire 2.0: Save preprint server as institution
Fixes #2774
2022-01-21 23:09:59 +03:00
Abe Jellinek 6b90a4eaf3 The New Yorker: Pull only the first JSON-LD block
Fixes #2768
2022-01-20 15:53:47 +04:00
Dan Stillman ea7fa1d16d IEEE Xplore: Fix translation on iOS where doc.defaultView is null
Fixes zotero/zotero-ios#414
2022-01-18 03:20:37 -05:00
wolf e7f32884f9
Repair ProQuest detection on non-Abstract pages (#2763) 2022-01-17 10:07:42 +04:00
Dan Stillman 037b130944 Clarify translator bug reporting 2022-01-17 00:34:33 -05:00
dependabot[bot] 85793ba116
Bump follow-redirects from 1.14.5 to 1.14.7
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.5 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.5...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-14 15:12:46 +00:00
Abe Jellinek c3f76bf3ae IETF: Update for link format changes
Fixes #2770
2022-01-14 14:11:46 +02:00
Abe Jellinek ba51c68030 Wikipedia: Use page URL for snapshot
So that the snapshot is generated by SingleFile.

https://forums.zotero.org/discussion/93760/wikipedia-snapshot-kills-zotero-and-fries-my-laptop
2022-01-14 13:57:53 +02:00
Abe Jellinek 8e72a724c0
Replace calls to callback-less selectItems() (#2758) 2022-01-03 15:32:41 -08:00
wolf 8d7bb94312
Vice: Use JSON-LD (#2761)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2022-01-03 15:15:11 -08:00
Abe Jellinek 0e3631a034 Don't split byline on "and" within word 2022-01-03 08:53:38 -08:00
pjrwees 74a2407d27
Make EUR-Lex work with more resources (#2324)
Co-authored-by: pjrwees <pjrwees@gmail.com>
2021-12-30 18:01:47 -08:00
reubot 22df859101
Fix minor error in NewsBank (#2757) 2021-12-30 17:42:43 -08:00
Bo An 9b673efd01
Add translator for the PRC History Review (#2743) 2021-12-30 10:34:39 -08:00
Dan Stillman d704902bc4 Crossref Unixref XML: Update tests 2021-12-29 15:20:56 -05:00
Dan Stillman ad1708ed51 Crossref Unixref XML: Fix string fieldMode 2021-12-29 15:20:56 -05:00
Dan Stillman 266e5ad25b Crossref Unixref XML: Fix reference book with 'other' component type
https://forums.zotero.org/discussion/93679/incorrect-entry-for-encyclopedia-entry-book-chapter-from-doi

Allow a `componentType` of `other` when the `bookType` is `reference`.
If the `bookType` is `other`, accept only `chapter` or `reference_type`
as before. Not sure whether an `other`/`other` edited book would be
possible, but this seems safer.
2021-12-29 15:20:56 -05:00
Abe Jellinek 493c481004 Add request methods to ESLint, update typing 2021-12-28 10:30:19 -08:00
Abe Jellinek 90bad6ba0b Typing: More improvements to accuracy/clarity 2021-12-27 22:05:47 -08:00
Abe Jellinek 12f85d774c Typing: Typed translation 2021-12-27 11:51:00 -08:00
Abe Jellinek 2bc6553199 Use GenericItem in handler
+ strongly typed getCreatorsForType.
2021-12-21 17:05:08 -08:00
Abe Jellinek dece3af22f Typing: Use union for more flexibility 2021-12-21 17:01:49 -08:00
Abe Jellinek 70cb4bdc84 Typing: Add async methods and item/creator types 2021-12-21 16:10:16 -08:00
Dan Stillman c70ea0aec5 Gale Databases: Fix URL-encoded URL for 'multiple' saves
https://forums.zotero.org/discussion/93150/zoteros-incorrect-url-metadata-for-eighteenth-century-collections-online-ecco

It looks like a decodeURIComponent() was removed in 6b5e6bb6cc (probably
because it's not actually necessary for single-page saves).
2021-12-20 23:19:16 -05:00
Martynas Bagdonas be5fc1633d
Add Note HTML translator (#2749) 2021-12-15 06:09:21 -05:00
Dan Stillman 8c06f0e76f Bump deleted version after 080905e01 2021-12-15 05:28:49 -05:00
Dan Stillman 080905e011 Note Markdown: Change id and mark previous id as deleted
I pushed this before blocking it from being served from the repo to
older clients.
2021-12-15 05:27:04 -05:00
Dan Stillman 78b9b4bf7e Add Note Markdown translator
From https://github.com/zotero/markdown-translator-builder

See zotero/zotero#2214
2021-12-15 05:06:30 -05:00
Dan Stillman d652a4de82 Add GitHub issue template 2021-12-07 18:01:04 -05:00
Dan Stillman ef1c1951ae University of Chicago Press Books: Fix incorrect regexp
This was failing on iOS.
2021-12-07 03:15:57 -05:00
Abe Jellinek f061fd97fa Elsevier Health Journals: Expand target
Fixes #2751
2021-11-24 15:10:31 -08:00
Abe Jellinek b76a66903a UW Madison Catalog: Fix multiples, update tests 2021-11-18 15:11:41 -08:00
Abe Jellinek b1d24b6b4b Twitter: Remove title regex check from detectWeb again
Fixes #2750
2021-11-18 14:52:45 -08:00
Sebastian Karcher 266959f763
Add University of Chicago Press Books (#2731)
Closes #2167, closes #2747
2021-11-18 14:41:47 -08:00
Dan Stillman 67f52a1ac6 Update ChromeDriver version for M1 compatibility
Not tested, but apparently fixes #2744
2021-11-10 03:40:23 -05:00
Dan Stillman 0d435d8a95 Embedded Metadata: Fix regression in 8d2ee28d2
This was breaking some versions of NYT pages (and possibly lots of other
stuff):

https://github.com/zotero/translation-server/issues/133#issuecomment-962562547
2021-11-07 02:45:14 -05:00
Abe Jellinek 9600579112 PNX: addata/btitle -> bookTitle 2021-11-06 13:20:42 -07:00
Abe Jellinek 56bee2885e PNX: Map 'buch' -> book, 'book_chapter' -> bookSection
https://forums.zotero.org/discussion/92610/primo-zotero-book-section-wrongly-identified-as-document-item-type
2021-11-06 13:06:06 -07:00
Abe Jellinek d5b57d6b5d
WorldCat: Split comma-separated authors, detect corrupted RIS (#2741) 2021-11-05 18:37:29 -04:00
Abe Jellinek 59e5c30a6d Cascadilla: Add protocol to attachment URLs
https://github.com/zotero/translators/pull/2736#issuecomment-953625064
2021-10-28 17:35:40 -07:00
Abe Jellinek add0dec248
Refer/BibIX import: Fall back to Generic (book) type (#2737) 2021-10-28 17:28:41 -07:00
Abe Jellinek a8afc45469
CI: Check test case creators (#2738) 2021-10-25 02:57:57 -04:00
Abe Jellinek bff177a789 AllAfrica: Remove FW, update for current site
Translator was detecting but not returning valid items.
2021-10-22 12:34:23 -07:00
Abe Jellinek 53c57c6e23
Add translator for Cascadilla Proceedings Project (Lingref) (#2736) 2021-10-22 09:57:38 -07:00
Abe Jellinek a906913f32
Add translator for OAPEN books/chapters (#2735) 2021-10-22 09:57:28 -07:00
Abe Jellinek 3f49dcb485
Nature: Capitalize small-caps spans in titles, preserve EM tags (#2734) 2021-10-21 17:47:46 -07:00
Sebastian Karcher 4d749b6b95
Make LowQual Metatags case-insensitive (#2730)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-10-21 17:31:39 -07:00
Abe Jellinek 1b5cbd2c3f NewsBank: Fix typo/linting 2021-10-21 12:34:02 -07:00
Abe Jellinek 5ee7e4b226 NewsBank: Support PDFs, older Readex layout for FBIS 2021-10-21 12:25:39 -07:00
Abe Jellinek 93270f48bb AM Digital: Support videoRecordings, tags 2021-10-20 22:00:53 -07:00
Abe Jellinek af6dff91a8 Eastview: Support new PDF reader and issue link 2021-10-20 21:57:30 -07:00
Abe Jellinek 537ec31fc9 Brill: Support bibliographies 2021-10-20 21:55:44 -07:00
Abe Jellinek b34c6bc06c dLibra: Fix blank icon, add another multipes format
detectWeb was sometimes returning an invalid item type (whatever is in
DC.type, which isn't usually a valid Zotero item type) and thus
displaying a blank connector icon.

Also removed a redundant search results URL check and added another
multiples format.
2021-10-20 21:23:38 -07:00
Abe Jellinek bd41056eb7
Add translator for openJur (#2733) 2021-10-20 12:17:31 -07:00
Sebastian Karcher ebe0243f78
Fix Air University (#2729) 2021-10-20 12:04:30 -07:00
Abe Jellinek 16f7bf370a EM: Fix Spanish name-splitting regression 2021-10-20 12:02:55 -07:00
Abe Jellinek a1d18e80fd
EM: Put W3 authors in a Set to remove duplicates (#2728) 2021-10-20 12:02:27 -07:00
Abe Jellinek 227f7de9f6
EM: Split on en-dashes, trim lastpage (#2727) 2021-10-13 11:44:44 -07:00
Sebastian Karcher 61cbc4ecaa
Add IHE (#2726) 2021-10-13 11:40:02 -07:00
Abe Jellinek d7c1e6212b
OVID Tagged: Prune quotes & suffixes, allow colons, lint (#2724) 2021-10-13 11:37:31 -07:00
Abe Jellinek d2559cac9b
Google Books: Fall back on page title if no dc:title (#2723) 2021-10-13 11:29:40 -07:00
Sebastian Karcher 2b0aaa7305
Embedded Metadata: Add HW Editors (#2182)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-10-13 11:29:02 -07:00
Sebastian Karcher ec38560005
Combine The Economic Times & Times of India (#2722)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-10-12 15:24:08 -07:00
Sebastian Karcher 0d28ee8c6a
Delete Nuclear Receptor Signaling (#2725) 2021-10-12 13:13:30 -07:00
Abe Jellinek 480e65446e Wiley: Detect invalid data in item.pages
Fixes #2135
2021-10-12 11:02:25 -07:00
Abe Jellinek 711db0e0a7
OECD: Rewrite for current site using EM (#2719) 2021-10-10 18:11:57 -07:00
Abe Jellinek 20a60e530d
National Gallery of Art: Update for current site (#2718) 2021-10-10 18:11:44 -07:00
Abe Jellinek 7f47e6bbf1 EBSCO: Don't download mismatched PDFs for PDF-less items
Fixes #2717
2021-10-10 18:07:30 -07:00
Sebastian Karcher 7692cb3f82
ProQuest: Fix dates for EEBO (#2721) 2021-10-09 19:56:31 -07:00
Sebastian Karcher 0e877ec319
Cambridge Core: Fix dates for First View (#2720) 2021-10-09 10:33:06 -07:00
Abe Jellinek 72e530b66a OVID Tagged: Keep text before "Journal" & ampersand in publicationTitle
The approach the translator was taking to strip noise from the
publicationTitle ended up leading to truncated titles in far too many
cases, particularly with journals named like "American Journal of ...".
2021-10-07 21:38:48 -07:00
Abe Jellinek 42a2d1208a
Cambridge Core: Fix/expand multiples (#2716) 2021-10-05 19:18:53 -07:00
Abe Jellinek 4b2a051426 ProQuest: Fix non-English interface support
We already supported non-English ProQuest, but language detection wasn't
working correctly because of a tiny page structure change.
2021-09-27 17:25:48 -07:00
Abe Jellinek 7e4854adfa WorldCat Discovery: Support non-English interfaces
Reported:
https://forums.zotero.org/discussion/comment/367201/#Comment_367201

This prioritizes a successful COinS-based type detection over the UI
scraping-based method we were using before. We sometimes get incorrect
type detections on fresh page loads, but the worst case is an article
being detected as a book, and that's better than no detection at
all. (data-testid turns out to have been as unstable as the comment
predicted it would be.)

Tests are a mess right now - v1 tests no longer work because the sites
they target have updated to v2. That'll wait for a separate commit.
2021-09-27 17:02:24 -07:00
Abe Jellinek dbb39e3f5d
Add translator for the Homeland Security Digital Library (#2715) 2021-09-27 16:39:12 -07:00
Abe Jellinek 430ab70e9d
Antikvarium: Update for site changes (#2714) 2021-09-27 16:39:04 -07:00
Abe Jellinek bcf6ea13ae PKP Catalog Systems: Don't store DOM node in title
Not bumping lastUpdated because I don't think this code ever actually
runs - EM should always return a title of some kind. Just fixing on
principle.
2021-09-23 17:01:52 -07:00
Abe Jellinek 13a4c02038
London Review of Books: Add reviewed authors (#2711) 2021-09-23 12:51:45 -07:00
Abe Jellinek 175f2bc64c CEEOL: Add another multiples selector and correct tests/target 2021-09-22 13:16:08 -07:00
Kim, Timotheus Chang-whae 9ba50a1276 Add translator for Central and Eastern European Online Library Journals 2021-09-22 13:15:45 -07:00
Abe Jellinek 90e573bf7a
Add translator for the Open Knowledge Repository (#2708)
One of the World Bank's open-access publication frontends. Items have an
excessive number of tags in some cases, but they're usually at least
relevant and useful.
2021-09-22 12:04:42 -07:00
Abe Jellinek f6b87308a0 Wiley: Prefer relative citation download URL 2021-09-22 12:02:11 -07:00
Abe Jellinek 2783e19aae
Linter: Validate lastUpdated and search terms more soundly (#2713)
This adds a basic test for correct lastUpdated date formatting, adds
adsBibcode to the list of supported search terms, and fixes search term
validation when a test case runs a search with multiple terms. (I don't
think that actually happens in the current translator codebase.)
2021-09-22 00:25:15 -04:00
Abe Jellinek a9c12a121f
ADS: Don't hardcode citation keys (#2712)
https://forums.zotero.org/discussion/comment/390627/#Comment_390627
2021-09-21 23:58:43 -04:00
Abe Jellinek 96e1a43994
Wiley: Use authors from BibTeX (#2707) 2021-09-21 09:57:52 -07:00
mjpelmear 4673ce30e8
Remove duplicate doWeb() function in DBLP Comp Sci (#2709) 2021-09-20 12:48:56 -07:00
Abe Jellinek 83437198be
JMLR: Conference paper abstracts, better proceedings titles (#2705) 2021-09-20 09:44:22 -07:00
Abe Jellinek e5346bbdf8
Wikipedia: Support multiples (#2703) 2021-09-19 15:02:24 -07:00
Abe Jellinek 8e7cd0e0fb
Reddit: Support subdomains and old.reddit multiples (#2702) 2021-09-19 15:02:19 -07:00
Abe Jellinek 31bc8b23bc
Add translator for PubPub journal/publisher archives (#2701) 2021-09-19 15:02:14 -07:00
Abe Jellinek 9476a75f76
PKP Catalog Systems: Support another multiples type (#2700)
+ remove test cases from a site no longer using OJS.
2021-09-19 15:02:07 -07:00
Abe Jellinek 7427650a8a
Add translator for LookUs journal archives (#2699) 2021-09-19 15:01:34 -07:00
Abe Jellinek dac775377e BAILII: Fix translation error, lint 2021-09-16 13:57:29 -07:00
kgronowski eabe3afef2
Update dLibra translator for dLibra 6 (#2342)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-09-16 13:32:48 -07:00
Abe Jellinek d6518119b5
Annual Reviews: Fix tags and multiples, lint/restructure (#2698) 2021-09-16 09:56:02 -07:00
Abe Jellinek aa8faf3737
Substack: Don't use canonical link (#2697) 2021-09-15 11:40:53 -07:00
Abe Jellinek 00f69f2565
Add translator for Citizen Lab reports (#2696)
These look like blog posts, but they're called reports and often have
report numbers (which we try to grab).
2021-09-15 10:21:22 -07:00
Abe Jellinek 9ca60ff55c
zbMATH: Trim Extra values, update tests (#2694)
* zbMATH: Trim Extra values, update tests

* zbMATH: Lint
2021-09-14 11:02:40 -07:00
yunusong 2e0464df76
Add translator for DBpia (#1311)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-09-13 17:26:10 -07:00
Bao f24f4fe333
The Guardian: update translator (#2646)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-09-13 14:33:29 -07:00
Abe Jellinek 4a8c4eef0e Slate: Update for current site, remove FW
Fixes #2695.
2021-09-13 14:28:27 -07:00
Denis Maier 0b846e5d37
Add translator for Dreier Neuerscheinungsdienst (#2344) 2021-09-10 12:07:40 -07:00
Abe Jellinek be3808ae05
Silverchair: Detect old(?) sites with .aspx URLs (#2691) 2021-09-10 12:02:03 -07:00
Abe Jellinek d1f5fb2cd2
Add translator for MPG IS Perceiving Systems (#2693) 2021-09-10 12:00:06 -07:00
Abe Jellinek 1a720eb84d
Add translator for MPG PuRe (#2692) 2021-09-10 12:00:01 -07:00
Abe Jellinek 0a7d2a7d87 DABI: Lint 2021-09-10 11:58:14 -07:00
Jens Mittelbach 33f4cab4b7
Add translator for DABI (#979)
Co-authored-by: Philipp Zumstein <zuphilip@users.noreply.github.com>
2021-09-10 11:55:22 -07:00
Guy Aglionby 6e82d036fd
Add alternate mappings for 'a' with ring diacritic (#1937) 2021-09-10 11:19:10 -07:00
Abe Jellinek a6c718f86d
Add translator for Failed Architecture (#2689) 2021-09-10 11:08:52 -07:00
Abe Jellinek 2eed61fe96
Add translator for Noor Digital Library (#2688) 2021-09-10 11:08:47 -07:00
Abe Jellinek 087ab69820
HAPI: Fix multiples and abstract cleaning (#2687) 2021-09-10 11:08:42 -07:00
reubot 8d2e9cf539
Add translator for NewsBank (#2285)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-09-09 18:35:13 -07:00
Abe Jellinek 41f95863ce
RFE/RL: Update for current site(s) (#2684) 2021-09-08 20:39:54 -07:00
Abe Jellinek 0f03584b04
Add translator for CQ Press publications (#2683)
I'm unsatisfied with a few aspects of this translator. The RIS they give
isn't excellent, but in some cases there's nothing we can do (e.g., in
the "Bicknell John" case, a human can tell that that's clearly a
reverse-order name, but the translator can't). There's a great diversity
of item types and search result formats on the site and I'm not
confident that I've handled every case. But this is a good start, at
least, and gives us full coverage with some imperfections.
2021-09-08 20:39:47 -07:00
Abe Jellinek 2870d3900c
Add translator for the National Technical Reports Library (#2679)
Multiples are mostly nonfunctional right now; I can't come up with a
monitorDOMChanges() selector that actually catches when the search
results table is populated.
2021-09-08 20:39:32 -07:00
Abe Jellinek 7df775416b
Elsevier Health Journals: Update target/detection/multiples (#2678) 2021-09-08 20:39:18 -07:00
Abe Jellinek fe2868a565
Add translator for LIVIVO (#2677)
German academic search engine.
2021-09-04 17:56:38 -07:00
Abe Jellinek bdd5489c9e
APS-Physics: Update for current site (#2680)
No more RIS export that I can find, but EM is quite good.
2021-09-03 12:47:12 -07:00
Abe Jellinek fd38283e18
Fix Philosopher's Imprint translator (#2681)
<meta> tags were ending up in the body due to malformed HTML, so EM
wasn't catching them.
2021-09-03 12:46:03 -07:00
Abe Jellinek ad35e766e9
De Gruyter: Update for current site (#2686)
Just makes some necessary tweaks to EM output now (instead of preferring the RIS as it did before).
2021-09-03 11:23:59 -07:00
Abe Jellinek 999417a040
Fix/rewrite Notre Dame Philosophical Reviews (#2676) 2021-09-02 22:32:31 -07:00
Abe Jellinek d9f438f26c
Add translator for Elsevier Pure (#2675)
+ delete DTU Orbit (handled by new translator)
2021-09-02 21:05:13 -07:00
Abe Jellinek 7bb0a1c311 IETF: Support rfc-editor.org /info/ pages 2021-09-02 15:03:05 -07:00
wolf b4dfdf0add
Add translator for Artforum (#1271)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-09-01 17:36:34 -07:00
Abe Jellinek 9bc7496a5f
Cyberpresse -> La Presse, update for current site (#2670) 2021-09-01 14:11:43 -07:00
Abe Jellinek bb9e5c00dd NTRS: Fix error on dateless meetings and monitor DOM 2021-08-31 21:48:00 -07:00
Abe Jellinek dba3ebf9d1 Bump deleted.txt version 2021-08-30 21:20:46 -07:00
Abe Jellinek 208078df75
SSRN: Update multiples selectors, lint (#2672) 2021-08-30 21:16:53 -07:00
Abe Jellinek e3cb4db747
Support the American Archive of Public Broadcasting (#2671)
The LoC's radio/TV broadcast archive. We would use the PBCore XML
produced by their API, but it lacks some of the metadata and would
require a new import translator.
2021-08-30 21:16:32 -07:00
Abe Jellinek 437b3c27bd Fix overly broad FAO Publications target
Was matching every URL containing "publications/".
2021-08-30 21:11:27 -07:00
Abe Jellinek 14ef8a88df Delete Hoovers translator 2021-08-30 20:32:45 -07:00
Abe Jellinek fdbe66c552
PsycNet: Fix detection, ProductCode selection, cleaning (#2669) 2021-08-30 20:26:01 -07:00
Abe Jellinek ea3ddbc120
Add translator for Pika library catalogs (#2661)
Not to be confused with PICA. VuFind-based, used by a consortium of
libraries in Colorado and some others.
2021-08-26 10:40:14 -07:00
Abe Jellinek edbd6d77be
The New Yorker: Update for current site (#2659) 2021-08-26 10:27:21 -07:00
Abe Jellinek 06639586df
Add translator for TimesMachine (#2660)
NYT archives.
2021-08-26 10:26:44 -07:00
JLueke bda6d74b49
YouTube: Update date selector and try to clean URL (#2658) 2021-08-26 10:16:30 -07:00
Abe Jellinek 4dd6e3a379 CEUR: Correct date and location cleaning, add URL
https://github.com/zotero/translators/issues/2015#issuecomment-903760422
2021-08-25 10:44:18 -07:00
Abe Jellinek c233f1684e
Add translator for arXiv Vanity (#2662)
An HTML renderer for arXiv papers.
2021-08-25 10:18:59 -07:00
Abe Jellinek 921b733dd3
ProQuest: Support letters/cables and another date field (#2654) 2021-08-25 10:18:18 -07:00
Ben Swift d48362d6e5
Add translator for National Gallery of Australia (#2663) 2021-08-25 10:05:11 -07:00
Camilo Gomez 7a6b54f1ca Fix translator for Baruch Foundation artwork
The target was left empty, so it was being taken as a generic translator
2021-08-20 15:00:00 -04:00
Abe Jellinek 77977ea199 LingBuzz: Include URL
See https://github.com/zotero/translators/pull/2257#issuecomment-901776065
2021-08-19 11:03:58 -06:00
Andrew Schwartz 822953cb8c
Add translator for the Colorado State Legislature (#2113)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-08-18 13:53:43 -06:00
Abe Jellinek 4205ca8aab Superlib: Caret in regex 2021-08-18 13:44:41 -06:00
018 0415d6e452
Add superlib.net translator (#2267) 2021-08-18 13:43:30 -06:00
Abe Jellinek 411a00c801
Add translator for Newlines Magazine (#2656) 2021-08-18 12:47:57 -06:00
Abe Jellinek a8e92f4e07
PKP Catalog Systems: Support issue TOC on home page (#2655) 2021-08-18 12:47:37 -06:00
Abe Jellinek 5781eaf743
Add translator for Kanopy (#2653)
Offers citation export, but only pregenerated in a few styles, so we'll
do it ourselves.
2021-08-18 12:46:47 -06:00
Abe Jellinek a2d7d8d38b
Add translator for SIPRI books & reports (#2652) 2021-08-18 12:46:41 -06:00
Abe Jellinek 24f55a00bd
Add translator for F1000 Research sites (#2651) 2021-08-18 12:46:35 -06:00
JLueke aa3b6ebcde
Fix for Tagesspiegel translator (#2657)
* fixes abstractNote, section, tags
* updates tests
* removes print action for snapshot
2021-08-18 12:40:23 -06:00
Abe Jellinek 1e191f5009
Add translator for Baruch Foundation artwork (#2645)
Just for fun, since I think their collection is cool.
2021-08-18 11:35:54 -06:00
Abe Jellinek 2073381a3f
Add translator for Human Rights Watch reports and news (#2644)
I really wish we could get ISBNs and publishers for everything, and
creators for world report chapters, but the former two only exist in the
PDF and the latter isn't in a consistent or parsable form.
2021-08-17 09:43:55 -06:00
Abe Jellinek 5e3511f350
PhilPapers: Support PhilArchive (#2643) 2021-08-17 09:26:17 -06:00
Abe Jellinek 275c65a13a
Add translator for SALT Research Archives (#2641)
dSpace. We should consider trying to come up with a standard translator
to augment EM output for dSpace archives, but I know that they can be
quite variable.
2021-08-17 09:26:08 -06:00
Abe Jellinek 604cdb9fc1 OSF Preprints: Catch some more multiples
We seem to need to monitor more than `childList` for some JS-populated
search results pages.
2021-08-16 17:48:28 -06:00
Dan Stillman 71f74e60b4
EM: Detect 'bylines' class in addition to 'byline' and 'vcard' (#2115) 2021-08-16 13:22:21 -06:00
Bao 0487c99811
PC Gamer: update translator (#2648) 2021-08-16 11:00:59 -06:00
Bao 86482c8e0e
Rock, Paper, Shotgun: rewrite translator (#2649) 2021-08-16 10:59:58 -06:00
Abe Jellinek 2b1a13f8af
L'Année Philologique: Update for current site (#2640) 2021-08-16 10:58:27 -06:00
Abe Jellinek b8cda93adc
Add translator for IAEA INIS (#2639)
The International Nuclear Information System, a large repository of
papers, documents, and books relating to nuclear physics.
2021-08-16 10:58:21 -06:00
Abe Jellinek d462b8a174
Add translator for FAO AGRIS (#2636) 2021-08-16 10:58:14 -06:00
Abe Jellinek 47fce221be
Add translator for Dimensions.ai (#2637) 2021-08-16 10:58:08 -06:00
Abe Jellinek aa893025d9
PKP Catalog Systems: Support issue pages (#2634) 2021-08-16 09:25:22 -06:00
Abe Jellinek 121c00fb00
Add translator for Ahval News (#2635) 2021-08-16 09:24:59 -06:00
Abe Jellinek a6eaa2c26a
The National Archives (UK): Rename translator, fix titles (#2633)
It's a little bit like The Who or The Ohio State University. You just
gotta have the article.

Item titles were occasionally including some label text from the page,
so I've switched to using the contents of the <title> tag instead.
2021-08-16 09:23:26 -06:00
Abe Jellinek 238e6c0aac Add translator for Ariana News 2021-08-16 09:20:43 -06:00
Abe Jellinek 040df138a1 Add translator for Pajhwok Afghan News 2021-08-16 02:59:47 -04:00
Abe Jellinek d4052ef212 Add translator for Khaama Press 2021-08-16 02:59:47 -04:00
Bao 6aac09b40f
PKP Catalog Systems: grab abstract from header (#2642) 2021-08-13 17:01:45 -06:00
Abe Jellinek ad780951fe
Add translator for USDA PubAg/NALDC (#2628) 2021-08-13 16:31:22 -06:00
Abe Jellinek 2350c0a35d
Add translator for NTL ROSA P (#2629)
The National Transportation Library's full-text source collection.
Pretty good RIS. MODS is referred to a lot in the HTML, so it might be
accessible somewhere, but I can't find it.
2021-08-13 16:31:08 -06:00
Abe Jellinek d64b3d8c1a
Primo 2018: Support `.urlToXmlPnxSingleRecord` (#2627) 2021-08-13 16:31:00 -06:00
Emiliano Heyns e968a17ef1
Vanity Fair: Remove FW, update for current site (#1871) 2021-08-13 16:25:22 -06:00
Abe Jellinek 9771f4f141 NPR: Reload page to get JSON-LD, support SPA load 2021-08-13 15:09:01 -06:00
Abe Jellinek 3cc009fd28
Merge pull request #1941 from owcz/the-art-newspaper 2021-08-13 14:41:15 -06:00
Abe Jellinek 1887ac06ad Update issue selector, remove fake author, add test
We don't really want "The Art Newspaper" as an author - articles with
only that author are effectively just not published under a creator's
name.
2021-08-13 14:38:52 -06:00
Abe Jellinek 417646e4ef Lint, update copyright 2021-08-13 14:28:32 -06:00
Wolf 1ab91ea556 Add The Art Newspaper.js
Handles article pages, home/section page CMS, search. Pulls magazine issue info when available.
2021-08-13 14:26:33 -06:00
Abe Jellinek ba8d39cac9
beck-online: Allow detection of proxied URLs (#2624)
+ ensure that the permalink is always absolute and unproxied.
2021-08-13 14:21:26 -06:00
Bao 6e022e0f8a
Rewrite translator for Toronto Star (#2638) 2021-08-13 14:19:54 -06:00
Abe Jellinek d6bc42b4c3 Brill: Support encyclopedias 2021-08-13 09:47:14 -06:00
Abe Jellinek be5b8d8a4a Brill: Journal issues as multiples 2021-08-12 23:39:53 -06:00
Abe Jellinek b5031f336b
Brill: Rewrite with new target, support books (#2630) 2021-08-12 23:33:57 -06:00
Abe Jellinek 8cf00cd2bf govinfo: Monitor DOM 2021-08-12 20:36:55 -06:00
Abe Jellinek b5a86ae3f7 Silverchair: Add another ID source, detect rate-limiting 2021-08-12 16:40:20 -06:00
Abe Jellinek f5d91ccb2e
Add translator for RAND publications (#2622) 2021-08-12 16:26:27 -06:00
Abe Jellinek bed268c7f3
Add translators for National Academies Press and NAP TRB (#2621) 2021-08-12 16:26:21 -06:00
Abe Jellinek 17b1ceeaa0
Frontiers: Rewrite; fix multiples, use RIS (#2620)
RIS gives us better metadata than EM, although we lose tags.
2021-08-12 16:24:41 -06:00
Abe Jellinek e7a22766d1
Add ISBN search to WHO translator (#2618) 2021-08-12 13:46:17 -06:00
Abe Jellinek c5343c913b
Merge pull request #2623 from zotero/dependabot/npm_and_yarn/jszip-3.7.1
Bump jszip from 3.5.0 to 3.7.1
2021-08-11 23:54:18 -06:00
Abe Jellinek ddb5762abc
ADS: Support arXiv preprints, save citation key and identifier (#2632)
ADS can work as an odd kind of proxy for arXiv when a bibcode starts
with the publication year followed by `arXiv`, so we should support
that.

Saving the citation key is mostly helpful for BBT users with an
ADS-heavy workflow who use bibcodes as citekeys (which seems to be
common), but it's worth having.

Put bibcode in its own extra field, too.
2021-08-12 01:46:12 -04:00
Abe Jellinek 16d27b57cb
Twitter: Restore title regex check, monitor DOM (#2619) 2021-08-11 22:22:42 -06:00
Abe Jellinek ed5f27b84a
Add translator for Dataverse catalogs (#2607) 2021-08-11 17:26:25 -06:00
Abe Jellinek ebb10df029
Add translator for Dar Almandumah (#2596) 2021-08-11 17:26:00 -06:00
Abe Jellinek 451b423253 Primo Normalized XML: Support print_book record type 2021-08-11 11:37:22 -06:00
Abe Jellinek 3b373b2115
Add hardcoded citations for IPCC AR6 Climate Change 2021 (#2625)
Co-authored-by: Dan Stillman <dstillman@zotero.org>
2021-08-10 15:38:44 -06:00
Abe Jellinek 7ab8adfc12
Add translator for Alsharekh (#2608)
Archived Arabic magazines and journals. No way to distinguish between
the two, and *most* are magazines, so we'll use that.
2021-08-10 13:57:48 -06:00
Abe Jellinek a40c59ced2
EM: Add heuristic for two-word Spanish surnames (#2578) 2021-08-10 13:55:26 -06:00
dependabot[bot] c633ac1b4a
Bump jszip from 3.5.0 to 3.7.1
Bumps [jszip](https://github.com/Stuk/jszip) from 3.5.0 to 3.7.1.
- [Release notes](https://github.com/Stuk/jszip/releases)
- [Changelog](https://github.com/Stuk/jszip/blob/master/CHANGES.md)
- [Commits](https://github.com/Stuk/jszip/compare/v3.5.0...v3.7.1)

---
updated-dependencies:
- dependency-name: jszip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 17:14:35 +00:00
Abe Jellinek 82b035dac0
HighWire 2.0: Support [med,bio]Rxiv and preprints (#2614)
No general way to detect preprints, so we just check for the Rxiv suffix
for now.
2021-08-10 11:08:12 -06:00
Abe Jellinek 7276ab4d44
Add translator for CEUR Workshop Proceedings (#2615) 2021-08-10 11:08:04 -06:00
Abe Jellinek 577174b01e
Update DBLP for new layout/URLs (#2616) 2021-08-10 11:07:57 -06:00
Abe Jellinek 813a24cdfa
InnoPAC: Support Canada Science Catalogue (#2612)
Also deleted old tests. Fixes #2504.
2021-08-09 18:08:29 -06:00
Abe Jellinek 136923f16e
Add translator for Finna library catalogs (#2610)
A VuFind-based consortium catalog system for Finnish libraries.
2021-08-09 16:59:02 -06:00
Abe Jellinek efa56a1cec
Add translator for ASTIS (#2609) 2021-08-09 16:58:45 -06:00
Abe Jellinek cdf4fc79aa
Add translator for ACLS Humanities EBook (#2605)
Search results seem to use Blacklight, but the detail pages are
different enough to be incompatible with that translator. We really only
need this to take priority over COinS.
2021-08-06 18:44:43 -06:00
Abe Jellinek e1312c9d35 Add translator for Current Affairs
Fixes #2606.
2021-08-06 18:43:29 -06:00
Dan Stillman 250e680d12 WHO: Detect HTTPS URL 2021-08-06 06:03:29 -04:00
Abe Jellinek 3a4d19c840
Add translator for the Bloomsbury Food Library (#2604) 2021-08-05 11:56:13 -06:00
Abe Jellinek 124f603951
Add translator for the Tony Blair Institute for Global Change (#2603) 2021-08-05 11:56:01 -06:00
Abe Jellinek 0bb4999fa8
Add translator for TIND ILS catalogs (#2597) 2021-08-04 15:42:51 -06:00
Abe Jellinek 7203bf9683
Update Neural Information Processing Systems for new site (#2601) 2021-08-04 15:42:35 -06:00
Abe Jellinek 2e4bf18a35
Add translator for Scholia (#2594)
Just a thin wrapper around the Wikidata translator.
2021-08-04 09:12:30 -06:00
Robert Sim 59736ead64
Add The Straits Times (#2319)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-08-04 09:10:42 -06:00
Abe Jellinek c1246a5da7 AM Digital: Fix search detection on even newer sites 2021-08-02 20:00:58 -06:00
Abe Jellinek 30a3f9557d
Add translator for IDEA ALM museum/archive catalogs (#2584)
Lots of catalogs in Israel and the Jewish world at large. The system
doesn't have very structured metadata, but this seems to cover the bulk
of cases.
2021-08-02 13:41:52 -06:00
Abe Jellinek 7780530f67 BibTeX: Map \textquotesingle to a neutral single quote
Only added to the import mapping; we don't really want to export this.
2021-08-02 11:16:52 -06:00
Abe Jellinek 0bfe13a2fe Google Presentation: Fix error when user doesn't have edit privileges 2021-08-02 10:57:19 -06:00
Abe Jellinek 8ac0063408
Add Bibliothèque nationale de France ISBN search translator (#2595)
Also updates LoC ISBN to prioritize BnF between LoC and K10plus.
2021-08-02 10:38:16 -06:00
Abe Jellinek ce70b40a81
Wikidata: Support datasets (#2593) 2021-08-02 10:25:33 -06:00
Abe Jellinek 13df653b5b
Add translator for IETF RFCs and Internet Drafts (#2589) 2021-08-02 10:19:12 -06:00
Camilo Bravo 79d8b24a4b
EBSCOhost: Fix detection when permanent link popup is open (#2600) 2021-08-02 10:18:31 -06:00
Abe Jellinek f619917fac Fix Silverchair not detecting some JAMA articles 2021-07-31 19:20:03 -06:00
Abe Jellinek 50145d8a66
Bnf: Remove all uses of made-up item type "single" (#2591)
Returning "single" was causing the connector icon to display as a blank
space. I think "document" is our best fallback for now, although some of
these might be appropriate to call artwork.

Additionally, some linting fixes and dead code removal.
2021-07-30 15:29:15 -06:00
Abe Jellinek 8930dd518e
T&F+NEJM: Use creators from RIS (#2587)
RIS has names in reverse order, so authors with two last names, etc.,
are handled without issue (as long as the journal's metadata is
correct).
2021-07-30 15:27:35 -06:00
Abe Jellinek a62b8c2c41 Gale Databases: Don't detect non-content pages 2021-07-29 16:41:15 -06:00
Abe Jellinek 6b5e6bb6cc Gale Databases: Fix multiples, restore RIS code from old translator 2021-07-29 16:34:11 -06:00
Abe Jellinek a43cada400 GitHub: Pull version from CFF 2021-07-29 13:28:47 -06:00
Abe Jellinek eb4f39007e
GitHub: Parse CITATION.cff or README when available (#2592) 2021-07-28 15:54:41 -06:00
Abe Jellinek a4b752694d BibTeX: Explain `day` 2021-07-28 10:11:17 -06:00
Abe Jellinek 4693babd01
Scopus: Update page scraping and lint (#2586) 2021-07-28 10:05:47 -06:00
Dan Stillman 971a137c02 Twitter: Remove title regex check from detectWeb()
c5e03788f7 (commitcomment-54054391)
2021-07-27 16:39:36 -04:00
Abe Jellinek de342dcc0d
BibTeX: Support day field, reorganize date construction (#2588) 2021-07-26 18:44:04 -06:00
Abe Jellinek 2722f5d287 NTSB Accident Reports: Fix element check
As in 446a4bcc81.
2021-07-26 12:39:55 -06:00
Abe Jellinek 13202917e8
Add translator for NTSB Accident Reports (#2577) 2021-07-26 12:36:46 -06:00
Abe Jellinek 59facf0be3
Rewrite Ancestry.com Federal Census for current site (#2582) 2021-07-26 12:29:48 -06:00
Abe Jellinek edfee5544a
Web of Science Nextgen/Tagged: Support conference papers (#2574) 2021-07-26 12:29:06 -06:00
Abe Jellinek 12be271331
Add translator for Data.gov (#2581) 2021-07-26 12:24:41 -06:00
Abe Jellinek b836996901
IMDb: Support TV episodes, map actor to castMember (#2583) 2021-07-26 12:24:30 -06:00
Abe Jellinek 5893f11172
Add translator for Research Square preprints (#2563) 2021-07-26 11:48:17 -06:00
Abe Jellinek 4a1abb0fda
Summon 2: Rewrite and update for current system (#2572)
I'm not sure if RIS export is new(er than the translator), but it sure
does make things easier.
2021-07-26 11:47:40 -06:00
Abe Jellinek c5e03788f7
Twitter: Don't detect untitled tweet views, fix link attachment regressions (#2567)
This primarily affects when a user opens a tweet by clicking on the
image, not the text, to get the full-screen lightbox view. Twitter
doesn't update the page title in that case, so it's very difficult for
us to scrape anything useful. Previously the translator would detect
'blogPost' but error out in `doWeb`; now we'll just not detect anything
at all. Better than a confusing error.

Also fixed a URL un-shortening regression. Now the only thing URLs are
missing is their www subdomain, if they have one. Twitter strips that
even from the hidden "unabbreviated" URL.
2021-07-26 11:46:18 -06:00
Abe Jellinek 2440c61dc0 SAILDART: Support frameset view 2021-07-26 11:36:31 -06:00
Félix Brezo, Ph. D d8f9cb92b3
Add BOE.es translator (#2216)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-26 11:08:08 -06:00
Abe Jellinek c967fcc2f9
Harpers -> Harper's Magazine; update and remove FW (#2580) 2021-07-26 10:57:33 -06:00
Abe Jellinek 8385a043bd
Add translator for artnet (#2570) 2021-07-26 10:28:11 -06:00
Abe Jellinek d148a15754
Add translator for CIA World Factbook (#2569) 2021-07-26 10:28:04 -06:00
Abe Jellinek 611ccc3613
Medium: Update selectors and blog title extraction (#2565) 2021-07-26 10:27:41 -06:00
Abe Jellinek 115b9b3dbd
Wikipedia: Don't detect edit pages (#2568)
Previously, navigating to a page like
https://en.wikipedia.org/w/index.php?title=Main_Page&action=edit would
cause the connector to detect an encyclopediaArticle, but translation
would fail when the revID regex didn't match.
2021-07-26 10:27:33 -06:00
Abe Jellinek 446a4bcc81 Wikipedia: Use Element check available in server sandbox 2021-07-25 08:00:55 -06:00
S. Sauvin 8b1985dbee
GitHub: Extract repo name from URL, not `og:title` (#2585)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-23 12:25:01 -06:00
Abe Jellinek d55c3f9018 WorldCat DS: Always monitor DOM, not just for search 2021-07-22 23:54:37 -06:00
Abe Jellinek 6d79064204 ARTstor: Monitor the DOM so detection works 2021-07-22 23:46:34 -06:00
Abe Jellinek cbff58e146 JMLR: Final fix to PDF regex 2021-07-22 23:16:34 -06:00
Abe Jellinek fd16ac50cf JMLR: Fix error on some PDF pages 2021-07-22 23:07:33 -06:00
Abe Jellinek bc13b83969 Remove old JMLR translator
The old translator had the wrong filename and I somehow missed it when
writing #2522. It only worked on JMLR's MIT subdomain, so the targets
didn't overlap. Not ideal to have to remove a translator that hasn't
actually been removed, just updated, but that was my mistake.
2021-07-22 23:02:30 -06:00
Abe Jellinek 8a4d2783c4 WoS Nextgen: Monitor DOM changes for multiples 2021-07-22 22:53:31 -06:00
Abe Jellinek 4d2d7938c0 Bibliontology RDF: Bump lastUpdated 2021-07-22 22:15:14 -06:00
Emiliano Heyns 931e57831d
Suppress error when Bibliontology RDF detect fails (#1942) 2021-07-22 22:05:06 -06:00
Dan Stillman 98140c1164
Embedded Metadata: Use `innerText` instead of `textContent` (#2122) 2021-07-22 21:58:45 -06:00
wolf d7d35bc707
Add UNZ Print Archive.js (#1272)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-22 21:44:19 -06:00
Abe Jellinek ba855dd5f5
Add translator for SAILDART Stanford AI Lab archive (#2562) 2021-07-22 21:28:34 -06:00
Abe Jellinek fa4de85c9d
Rewrite/fix INSPIRE (#2564)
No Endnote XML anymore, just BibTeX.
2021-07-22 21:27:54 -06:00
Abe Jellinek e5ae43299e La Nación: Remove special last name handling
Those are middle names, not matrinames. Most Argentinean people don't
have two last names, so we shouldn't treat it as the default.
2021-07-22 21:22:27 -06:00
Abe Jellinek e7e75e4b07 ABC News Australia: Fix regex 2021-07-22 18:30:17 -06:00
Joyce Chia 2b251a2ae2
Add ABC News (#2186)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-22 18:28:54 -06:00
Abe Jellinek 721199c52f
Wikidata: Save PM(C)IDs, integrate tag creation (#2573) 2021-07-22 14:17:53 -06:00
Abe Jellinek 5d203a2d48
zotero.org: Don't try to scrape multiples when empty (#2560)
Previously, opening an empty collection would display the folder icon in
the connector. When clicked, the translator would try to call
selectItems with empty input and the connector would display an error.
This fixes detection so that we no longer detect anything if we're in an
empty collection.
2021-07-22 09:43:16 -06:00
Abe Jellinek 1064c27908 Wikipedia: Correct markup filtering logic 2021-07-21 11:40:58 -06:00
Abe Jellinek 2b2901da6b
Fix importing PubMed XML with only a non-English title (#2575) 2021-07-21 09:19:01 -06:00
Abe Jellinek d51ee39c9f
Add translator for the Institute of Contemporary Art (#2559) 2021-07-20 21:27:57 -06:00
Abe Jellinek 812a6fabaa
Add basic MODS-based translator for govinfo(.gov) (#2558) 2021-07-20 21:27:50 -06:00
Abe Jellinek 911d217126 Engineering Village: Monitor DOM changes broadly
After some trial and error, this seems to be the best fix for the issues
that some users were experiencing. I was having no problem
detecting/translating single items, though, only multiples. Remains to
be seen if anything else needs to be fixed.

Fixes #2034.
2021-07-20 19:46:18 -06:00
abroenni 11e50ffcd9
ScienceDirect: Construct PDF URL from JSON metadata (#2503)
When accessed via some academic networks, ScienceDirect will serve a JSON
metadata block that contains enough information to build a full-text PDF URL.
We now use it whenever possible.
2021-07-20 12:08:42 -06:00
Abe Jellinek 817ac01f79
Add translator for Substack (#2566) 2021-07-20 10:50:34 -06:00
Abe Jellinek 752c8bb6c4
Replace FW-based Atlanta Journal-Constitution translator (#2555) 2021-07-20 08:23:42 -06:00
Abe Jellinek dd047e2699
EBSCOhost: Disambiguate subtitles and journal titles (#2554) 2021-07-20 08:21:51 -06:00
Abe Jellinek 884260f7f4
Endnote XML: Import <label> as citation key in Extra (#2556) 2021-07-19 10:52:05 -06:00
Abe Jellinek efd6557565
Add translator for Visual Library 2021 catalogs (#2551) 2021-07-19 10:43:06 -06:00
Abe Jellinek c9f0e0e072
Aus. Dict. of Biography: Rewrite without FW + more metadata (#2552) 2021-07-19 10:24:44 -06:00
Abe Jellinek 700e101238
Add translator for NPR articles, broadcasts, and podcasts (#2550) 2021-07-19 10:24:21 -06:00
Abe Jellinek 83b4196d99
Fix Globe and Mail (#2557) 2021-07-19 10:23:56 -06:00
Abe Jellinek c1367fa85e Fatcat: Quick fix for duplicate pub title data
For some reason, EM is scraping Fatcat publication titles into both
publicationTitle and seriesTitle. We'll just remove one (ideally
seriesTitle when publicationTitle is also supported).
2021-07-18 17:05:51 -06:00
Abe Jellinek 36d15c501d
Add translator for Oxford Dictionaries Premium (#2548) 2021-07-16 12:22:49 -06:00
Abe Jellinek 2437219f93
Add translator for Wikiwand (Wikipedia frontend) (#2549) 2021-07-16 12:22:39 -06:00
Abe Jellinek 217660788e
Update Papers Past for current site (#2544) 2021-07-16 11:33:34 -06:00
Abe Jellinek 19debd9aad
Add translator for the Library of Congress's METS format (#2541) 2021-07-16 11:33:26 -06:00
Abe Jellinek 9fdb35ee8e
Eastview: Update for current site, update tests (#2547) 2021-07-16 11:33:02 -06:00
Abe Jellinek 6108d9f5c4
Add translator for DOAJ (#2539) 2021-07-16 09:35:02 -06:00
Abe Jellinek 5a486c07ad
MODS: Various detection and translation improvements (#2553)
- Support `letter`s, detecting them based on the presence of an `rcp` (recipient) MARC relator. It's possible that there's a genre heuristic we could use, but I don't have a good example of an appropriate item. (The letter item I'm working with has all its genre information, etc., in German.)
- Support `hearing`s, and don't treat all government publications as books.
- Improve detection: `tagName` includes the tag's namespace, so in order to detect namespaced MODS documents we need to use `endsWith` instead of `===`.
- When possible, fill the `language` field using language codes instead of localized names.
- Allow non-inverted single-part names, exclude publishers from `creators`, and use appropriate fallback creator types for item types that don't support the usual one (e.g. `hearing` doesn't support `author`).
- Actually process all attachments, not just the first. (That was a bug.)
2021-07-16 08:15:53 -06:00
Dan Stillman 7ff197489b Crossref Unixref XML: Bump timestamp
We've had a couple reports of this file being missing [1], causing PDF
metadata retrieval to freeze. I'm not sure how that would've happened,
but it's possible it's more fallout from the renamed-translator bug that
was fixed in bde9a74f9, which still exists on 5.0.96.2.

To be safe, push this out again, which should cause it to be recreated.

[1] https://forums.zotero.org/discussion/90750/progress-window-stuck-during-pdf-metadata-retrieval
2021-07-15 05:33:39 -04:00
Abe Jellinek 4ebd04aee2
Landesbibliographie B-W: Fix institutional authors, update target (#2546) 2021-07-14 15:57:07 -06:00
Abe Jellinek 8ff9215f6e
Fix Biblio.com pulling no data (#2543) 2021-07-14 15:54:36 -06:00
Vincent Carret 4ced1f01f9
New translator for the Journal of Religion & Society (#2062)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-14 14:07:49 -06:00
Abe Jellinek 57f386ae68
Add translator for CalMatters (#2526) 2021-07-14 10:09:17 -06:00
Abe Jellinek a73b2d13f2
Add translator for CROSBI (#2540) 2021-07-14 00:10:03 -06:00
Abe Jellinek fa42be61bb
Digital Medievalist: Merge with Ubiquity Journals (#2545) 2021-07-14 00:09:40 -06:00
Abe Jellinek 36a2e7ed5b
Fix Juricaf, remove FW (#2542) 2021-07-13 22:23:57 -06:00
Abe Jellinek 941f210f27
Add translator for World Digital Library (#2537) 2021-07-13 19:54:51 -06:00
Abe Jellinek 680c970dd8
Talis Aspire: Fix RIS URLs, update layout, remove 404'd tests (#2534) 2021-07-13 14:58:23 -06:00
Abe Jellinek b5706581b6
Add translator for Calisphere (#2528)
It looks a LOT like CONTENTdm, but it's actually Calisphere's own
open-source CMS package!
2021-07-13 14:58:14 -06:00
Abe Jellinek befeccb849
Add translator for Goodreads (#2527) 2021-07-13 14:57:47 -06:00
Abe Jellinek c60fc83ba4
Add translator for University Press Scholarship sites (#2524) 2021-07-12 09:10:25 -07:00
Abe Jellinek 5ed08026e2
Add translator for Herder journals (#2523) 2021-07-12 09:09:26 -07:00
Abe Jellinek fae905239c
ESpacenet: Support multiples (#2521) 2021-07-12 09:08:22 -07:00
Abe Jellinek 965ad18bee
Add translator for Qatar Digital Library (#2536)
A bilingual online archive of primary sources from the Middle East and
elsewhere. We grab the IIIF metadata and parse it, augmenting some
fields with information from the page.
2021-07-09 15:03:41 -07:00
Abe Jellinek c175e38638
Add translator for Journal of Machine Learning Research (#2522) 2021-07-09 15:03:25 -07:00
Abe Jellinek 4cee8dca81
Highwire 2.0: Fix detection on PNAS, maybe others (#2538) 2021-07-09 10:33:20 -07:00
Abe Jellinek ed37b4e003
Spiegel Online -> Der Spiegel, rewrite for current site (#2516) 2021-07-09 09:08:06 -07:00
Abe Jellinek 3d1e35fc10
Google Patents: Support translation server, update tests (#2515) 2021-07-09 09:08:00 -07:00
Abe Jellinek 851da2eab7
Reuters: Update for current site (#2514) 2021-07-09 09:07:54 -07:00
Abe Jellinek 9c6ecddc49
Create ADS Bibcode search translator (#2529) 2021-07-09 09:07:26 -07:00
Adomas Ven e048ef4092
RIS: Fix parsing error when attachment URL is not encoded correctly (#2513) 2021-07-09 01:34:40 -04:00
Abe Jellinek 5cd5499f6e
NBER: Support PDF pages and www2 URLs (#2519) 2021-07-08 16:37:22 -07:00
Abe Jellinek dc0cc10bef
Atypon: Support Informit.org, replace its old translator (#2525) 2021-07-08 12:50:52 -07:00
Abe Jellinek 9ba519cfaa
Open Journal Systems -> PKP Catalog Systems (#2517)
Updated with support for Open Monograph Press (books) and Open Preprint
Systems (preprints). EM can do most of the work for all of them. Also
removed snapshots, which aren't really relevant for catalogs like this.
2021-07-08 12:49:03 -07:00
Abe Jellinek 8995fa3a8d
Remove A Contra Corriente; handled by OJS (#2518)
See #2517.
2021-07-08 12:48:24 -07:00
Abe Jellinek f54ae2d5fc
Remove Early English Books Online (#2530)
Merged with ProQuest.
2021-07-08 11:29:07 -07:00
Abe Jellinek c01ba29f45 CI: Revert to pre-#2520 approach, increase depth to 100
I'm sure there's a better way, but GH Actions are hard to test
locally (the checkout action functions differently in Act! cool!) and
the various supposedly better approaches I've tried have only led
it *always* to fail rather than only failing on old PRs.
2021-07-08 09:16:12 -07:00
Abe Jellinek fc6738c28d CI: Try a different fetch approach
https://github.com/actions/checkout/issues/266#issuecomment-638346893
2021-07-08 09:11:05 -07:00
Abe Jellinek 649c132fe0 CI: Set fetch-depth: 0, don't manually fetch history
Works locally with Act. On the server? We'll see!
2021-07-08 08:46:26 -07:00
Abe Jellinek 1a51c56525
Update ARTFL Encyclopedie (#2505) 2021-07-08 08:17:53 -07:00
Abe Jellinek 02cccbf163 Editor support: Add more utilities to d.ts 2021-07-07 22:30:46 -07:00
Vincent Carret 801d341aa0
Translator for Library Hub Discover search results (#2082)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-07 11:59:19 -07:00
Abe Jellinek 49b4676843
Reddit: Allow uppercase URLs, skip deleted authors (#2511) 2021-07-07 10:40:59 -07:00
Abe Jellinek cb42ffc4c1
ARTstor: Rewrite for current site (#2506)
The site has very diverse metadata by item type and collection, so I'm
not confident that this covers every case, but it works for everything
I've tested it on. Unlike the old translator, it downloads full-size
images.
2021-07-07 10:40:48 -07:00
Abe Jellinek e7584836cd
CI: Don't limit fetch depth at all (#2520) 2021-07-06 15:36:33 -04:00
Sylvain Machefert a35a812fcf
Add translator for Sud Ouest (#2314) 2021-07-06 10:29:34 -07:00
Abe Jellinek a5b7f63ce6
ScienceDirect: Detect search pages, normalize name spacing (#2510) 2021-07-06 10:26:44 -07:00
Abe Jellinek a0a8593c80
HathiTrust: Extract more metadata, support reader page (#2512) 2021-07-06 08:33:49 -07:00
Abe Jellinek b5e7af6d20
Add translator for Stanford University Press (#2509) 2021-07-05 23:50:37 -07:00
Abe Jellinek 621d3dfd66
Add translator for Bookshop.org (#2508) 2021-07-05 09:57:30 -07:00
Abe Jellinek 2d0fb64cb1
Isidore: Rewrite for current site (#2500)
Just an EM wrapper with handling for full-text links. (There's no way to
tell whether a link will go straight to a PDF, so attachments are
impractical.)
2021-07-05 09:04:57 -07:00
Abe Jellinek 2ab5721509 EM: Resolve protocol-relative URLs
Handles most of #1827, but I still need to find a solid approach for
relative URLs with `..`.
2021-07-04 17:12:34 -07:00
Abe Jellinek 23f5dfc560
WorldCat Discovery: Support v2 site (#2497)
I pursued two metadata sources for this: RIS, which the original
translator uses, and internal WorldCat metadata. WorldCat metadata is
promising: it includes correct creator types (everyone is AU in the
RIS), cleaner creator names, and an abstract. But it's locked behind a
client-generated API key system that requires access to the JS HMAC API.
I wrote a hosted lambda function to generate the required values, but
after a day of working on a translator, I was still only getting
passable data. It was a fragile approach with significant data-cleaning
issues.

Although there are downsides to the RIS they give us, users are already
used to them. We can stick with it for now.
2021-07-04 17:00:23 -07:00
Abe Jellinek cd92edf0db
Add translator for University of California Press books (#2501) 2021-07-04 16:59:09 -07:00
Abe Jellinek 769ec480a0
Add translator for SLUB Dresden library catalog (#2498) 2021-07-04 16:57:12 -07:00
Abe Jellinek 3c36818f13
Add translator for Deutsche Fotothek photographs (#2499) 2021-07-04 16:54:35 -07:00
Abe Jellinek e5242043b0 Fatcat: Exclude non-metadata pages
Ideally we can use processDocuments() to fetch the metadata page when
we're on a different tab (Authors, References, Metadata), but this is a
quick fix to prevent empty items.
2021-07-03 19:38:21 -07:00
Jean-François Rivière bcf37b48e1
Update Revues.org to OpenEdition Journals (#2188)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-07-01 17:29:23 -07:00
Abe Jellinek 96a08bc62c BibTeX: Update one test for @misc item type change
See 951c786833
2021-07-01 12:05:37 -07:00
Sebastian Karcher 8b4fee34f7
BibTex: Fix URLs and preamble (#2348)
Imports dates as ISO

Closes #2318 and #2313
2021-07-01 12:01:51 -07:00
Abe Jellinek 29a9715352
Add translator for NYPL Menus (#2483) 2021-07-01 09:40:01 -07:00
Bo An 45e05a65c0
Add translator for Verso Books (#2494) 2021-07-01 09:33:03 -07:00
Sylvain Machefert aaaecfd6b3
Idref: Support five more sources (#2495) 2021-06-30 10:17:24 -07:00
Dan Stillman 7996f2ede8 Bump the GBV placeholder timestamp to force re-push
The webhook timed out for reasons that I need to look into.
2021-06-29 23:16:03 -04:00
Dan Stillman e145f52d40 Temporary fix for broken search translation after GBV rename
This adds a temporary no-op "Gemeinsamer Bibliotheksverbund ISBN.js"
file to avoid the broken-identifier-lookup-until-restart problem fixed
by zotero/zotero@bde9a74f9d and zotero/zotero@b8ad18e96
2021-06-29 22:45:17 -04:00
Abe Jellinek b7e422040b
GitHub: Pickier detectWeb, safer selectors (#2492) 2021-06-28 23:53:26 -07:00
Guy Aglionby e6b53e9ef3
Add MIT Press translator (#2043)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-28 15:28:39 -07:00
Abe Jellinek b3064e24d6
Add translators for Fatcat & Internet Archive Scholar (#2478) 2021-06-28 12:40:27 -07:00
Guy Aglionby 286ef204aa
Update ACL translator for HTML change (#2496) 2021-06-28 12:19:39 -07:00
Abe Jellinek b65cc266d1
Trove: Monitor DOM and correct type mapping logic (#2485) 2021-06-28 11:45:33 -07:00
Abe Jellinek 96ccaae9e3
Remove National Archives of the US, fix up replacement (#2477) 2021-06-28 11:45:20 -07:00
Abe Jellinek da1a5dd536
Bryn Mawr Classical Review: Update for current site (#2476) 2021-06-28 11:44:16 -07:00
Abe Jellinek 6bfdb8f4ea
OJS: Update selectors for detection and attachments (#2473) 2021-06-24 14:53:14 -07:00
Abe Jellinek 83fb5f2103
Add translator for NYPL Research Catalog (#2482) 2021-06-24 14:29:17 -07:00
Abe Jellinek b96d50feb4
Amazon compatibility fixes and data cleaning improvements (#2491) 2021-06-24 14:06:12 -04:00
Georg Mayr-Duffner 1418c049b5
Use k10plus SRU for ISBN lookup instead of GBV SRU (#2479) 2021-06-24 09:18:23 -07:00
Abe Jellinek 74e9c80783 Editor support: Add notes to items 2021-06-23 10:15:54 -07:00
Abe Jellinek 334fb19ef1
Remove Chadwyck Literature Online (#2487) 2021-06-23 09:50:32 -07:00
Abe Jellinek 815e2dbe85
ZoteroBib: Monitor DOM changes on outermost element (#2484) 2021-06-23 01:53:26 -04:00
Abe Jellinek f2f6fa2a14
Gene Ontology: Partial rewrite (#2467)
Updated selectors, linted, and simplified the translator's structure a bit.
2021-06-22 18:29:48 -07:00
Abe Jellinek 06983695f1
Add translator for Europe PMC (#2469) 2021-06-22 18:29:25 -07:00
Abe Jellinek a6d1b28d5e
RSC: Fix `detectWeb` regression (#2480)
https://github.com/zotero/translators/pull/2462#discussion_r656284953
2021-06-22 07:50:15 -07:00
Abe Jellinek 87efa739bf
Remove Archives Canada-France (#2475) 2021-06-22 01:00:40 -07:00
Abe Jellinek 9634d1c67f
NASA ADS: Discard unabbreviated journal abbreviation (#2466) 2021-06-21 23:03:26 -07:00
Abe Jellinek 3fd747b4fa
EM: Don't use `location.toString()` (#2474)
Doesn't work when EM is called from another translator in Scaffold and
maybe elsewhere.
2021-06-21 10:20:15 -07:00
Sebastian Karcher bbda0ebc05
Add LID to .nbib (#2468) 2021-06-21 10:17:28 -07:00
Abe Jellinek b98724aa9a
Add translator for Web of Science Nextgen (#2464)
Web of Science is running two sites in parallel right now: a legacy site
and a beta "Nextgen" or "New" site. The "New" one is set to become the
default soon, but the existing WoS translator doesn't support it at all.
It now uses Angular and doesn't easily give us any of the form data that
the existing translator uses in order to pull item metadata. I didn't
want to clog up the old translator with layers and layers of
conditionals, so I created a new one.

The least dependable part right now is the URL. The translator tries to
pull it from the "Full text at publisher" button on the page, but that
doesn't show up in the static HTML, so search results don't get URLs.
I'm not sure what to do about that yet.

The app itself populates its model via RPC over a WebSocket.
2021-06-21 09:23:38 -07:00
Abe Jellinek 29124e358d
RSC: Pull supplementary information PDFs (#2462) 2021-06-21 09:23:25 -07:00
pjrwees 0d8127806e
Add Rechtspraak.nl translator (#2325)
Co-authored-by: pjrwees <pjrwees@gmail.com>
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-18 14:55:16 -07:00
Sebastian Karcher 126a408da3
Pubmed/PMC: Add eid to page number (#2465) 2021-06-18 14:41:52 -07:00
Abe Jellinek 336611e39a
EM: Convert relative URLs, add a test for double NS (#2463) 2021-06-18 12:19:51 -07:00
Abe Jellinek ac80099716
Atypon Journals: Support latest layout and fix ASM creators (#2456) 2021-06-18 10:36:50 -07:00
Emiliano Heyns ee4c030368
eMJA.js: Update for site changes, remove FW (#1964)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-18 10:36:02 -07:00
Luke van der Hoeven 147e3c2e17
Add translator for JETS (#1819)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-17 17:06:05 -07:00
Philipp Zumstein d6e958359d
Handle double namespaces in EM e.g. for og:video (#2094) 2021-06-17 13:34:30 -07:00
Abe Jellinek bc7f77de91
Louvre: New domain, use JSON-LD, try to clean names (#2440) 2021-06-17 08:18:25 -07:00
Bo An 2a2f47f501
Update Baidu Scholar (#2460) 2021-06-17 08:15:25 -07:00
Dan Stillman d1c4000b26
Merge pull request #2458 from AbeJellinek/nasa-ads
NASA ADS: Generate token for new API, correct PDF ordering
2021-06-16 22:48:04 -04:00
Abe Jellinek 8fdfcb22f5 New Left Review: Escape periods 2021-06-16 14:17:35 -07:00
Bo An d70332d7b7
Add translator for New Left Review (#2453) 2021-06-16 14:14:18 -07:00
Abe Jellinek b65170db83
Trove: Handle books, articles, art, and multiples (#2442) 2021-06-16 08:05:48 -07:00
Abe Jellinek 6934c46c50 Editor support: Correct doPost argument order 2021-06-15 10:21:14 -07:00
Abe Jellinek fba8780f6e
National Post: Update for current layout (#2451) 2021-06-15 09:20:31 -07:00
Abe Jellinek ca3494fdea
MCV: Use JSON-LD, decode HTML entities (#2450) 2021-06-15 09:20:25 -07:00
Abe Jellinek 376039ab61
Sveriges radio: Update URLs, selectors, and tests (#2449) 2021-06-15 09:19:58 -07:00
Abe Jellinek f71c44ed7a
La Nación: Use JSON-LD, fix multiples (#2447)
No test for search now because it doesn't really have a URL; the search
results box pops up above the page you're on without a redirect.
Scraping it works well.
2021-06-15 09:19:41 -07:00
Abe Jellinek f08d7a9c29
R-Packages: Update selectors (#2446) 2021-06-15 09:19:17 -07:00
Abe Jellinek d5f5b6a027
Frieze: Update for current layout (#2444) 2021-06-15 09:19:10 -07:00
Abe Jellinek 920694c4ad
NBER: Scrape books and chapters, update BibTeX URL (#2443) 2021-06-15 09:18:53 -07:00
Abe Jellinek de8cbf85e1 NASA ADS: Fix PDF URL race condition
Rather than assuming that RIS processing will complete in the same order
that it begins, we use items' URLs.
2021-06-15 08:45:34 -07:00
Abe Jellinek 875dc98ff2 NASA ADS: Generate token for new API
ADS has a nice new API, but it requires a token to access. I
experimented with creating an account and writing a proxy, but I
realized that there's a much simpler way: we can just generate a
temporary token exactly as the site does when you generate a citation in
the browser, by calling the '/accounts/bootstrap' endpoint. Works great.

Updated old tests and added a new one. Everything now seems to be
working just as it was before the update.
2021-06-15 08:38:19 -07:00
Abe Jellinek ea18e9b5c8 OED: Fix multiples 2021-06-14 14:26:51 -07:00
Emiliano Heyns 091d25065b
Oxford English Dictionary: Remove translator framework (#1977)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-14 14:20:51 -07:00
Vincent Carret c6e8c697aa
New translator for scinapse.io (#2064)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-14 14:03:52 -07:00
PChemGuy d8c626e930
Add translator for Russian State Library (#2166)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-14 13:21:27 -07:00
Abe Jellinek cb9bddd4e1 The Intercept: Linting 2021-06-14 12:54:37 -07:00
Abe Jellinek 191ea4a208 The Intercept: Update JSON author key and metadata classes 2021-06-14 12:54:37 -07:00
wolf 8f05a5c98a
Add Le Maitron (#1803)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-14 12:48:05 -07:00
dependabot[bot] 2b941b31a3
Bump glob-parent from 5.1.1 to 5.1.2 (#2418)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-14 10:03:33 -07:00
Ohad Kimhy 3839229a71
Primo: Fix tests, update regex, and lint (#2116)
Co-authored-by: Sebastian Karcher <karcher@u.northwestern.edu>
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-14 10:00:11 -07:00
Abe Jellinek f04d53c1c4
Wayback Machine: Monitor DOM changes for multiples (#2439) 2021-06-12 07:35:08 -06:00
Abe Jellinek dcdde7c944
Remove MIT Press Journals (#2448) 2021-06-12 07:34:28 -06:00
Dan Stillman af06ee8b14 Desiring God: Not a search translator
The translator was being checked for doSearch() (which failed) on every
DOI/ISBN lookup with `TypeError: Function.prototype.apply called on
incompatible undefined`.
2021-06-11 13:21:26 -04:00
Abe Jellinek 1468e69572
JSTOR: Fix double colon in title, detect bookSection (#2420) 2021-06-11 06:10:06 -07:00
Abe Jellinek cf6eacd427
AM Digital: Allow for archives stored in Collection (#2419) 2021-06-10 21:21:45 -07:00
Bo An 44b0810273
Update Library Genesis mirrors (#2441) 2021-06-10 21:15:45 -07:00
Abe Jellinek a286991c83 Delete CiteULike 2021-06-09 20:47:08 -05:00
Abe Jellinek 8e6f474a0f OSA: Update existing tests 2021-06-09 20:46:08 -05:00
Abe Jellinek 5b1d2556a0 OSA: Decode double-escaped HTML entities in metadata
Fixes #2360
2021-06-09 20:46:08 -05:00
Abe Jellinek 7ad48da547 NASA NTRS: Don't throw an error when the page hasn't loaded
If the translator throws an error in detectWeb, the connector won't give
it a chance to run again when Angular page content loads completely.
We'll just return false when loading hasn't completed instead.
2021-06-09 12:14:04 -05:00
Abe Jellinek 335dad5f5b
RIS: Un-deprecate A1 (#2437) 2021-06-09 11:50:01 -05:00
Abe Jellinek 441be8b350 NASA NTRS: Classify technical note as report 2021-06-09 10:19:57 -05:00
Abe Jellinek 92878c8d27
NASA NTRS: Update for new site (#2414)
We get very pretty JSON now, which is great, but it has a little less
information, which isn't. (Not sure where "Imprint and Other Notes" and
"Description" went.) Extra data used to be stored as notes - I moved it
to Extra for consistency with other translators.
2021-06-09 08:32:38 -05:00
swifterslb 5e60a1ec89
FAO Publications: Update DOI method (#2249)
When paired with citation-style-language/styles#5492,
this should give correct results for FAO citations.
2021-06-09 08:14:37 -05:00
Abe Jellinek 14a92b61df
YouTube: Scrape correct creator and description (#2412) 2021-06-09 08:09:44 -05:00
Brenton M. Wiernik 8784145c64
Remove old extraToCSL format from translators (#2041) 2021-06-08 09:37:33 -05:00
Göktuğ Kayaalp 49997d6d0b
Add LingBuzz (#2257)
Co-authored-by: Abe Jellinek <jellinek@berkeley.edu>
2021-06-07 17:14:06 -05:00
Abe Jellinek 436fae2c17
Ynet: Update for current site, support Ynetnews (English) (#2413) 2021-06-07 17:13:34 -05:00
Philipp Zumstein 2756c0124c
Add WikidataQuickStatements translator (from zotkat) (#2339) 2021-06-07 17:12:22 -05:00
Abe Jellinek 7218d35244 Retsinformation: Use JSON, not XML, for same results as old translator
The XML was nice, but it's slow to download and not focused on providing
human-readable data (which is what we want for most fields). The JSON
gives us the date in a form that's a bit *too* human readable, but
strToISO can parse it. Making two requests would be the best of both
worlds, but I don't want to grab the XML if it isn't strictly necessary,
and it's not.
2021-06-07 14:49:13 -05:00
Abe Jellinek e707672ea4
Wiley: Clean DOIs and update tests (#2411)
Embedded Metadata translator already cleans its DOIs, so we don't need
to handle that case.

The <meta> citation date has lost its month/day for some test items, but
other items already only had a year.
2021-06-07 12:53:48 -05:00
Abe Jellinek 6accf5952c
Escape dots in target regexes (#2416) 2021-06-07 12:26:56 -05:00
Abe Jellinek 1894c52bb6
RIS: Defer processing deprecated tags (#2386) 2021-06-07 09:31:03 -05:00
nikhil trivedi bd3db2885b
Add translator for Art Institute of Chicago (#2337) 2021-06-04 15:41:15 -05:00
Abe Jellinek bfcb9add6b
Retsinformation: Update for new site (#2405) 2021-06-04 14:20:17 -05:00
ado2102 819767964b
Newspapers.com: Save PDF instead of image (#2156)
Co-authored-by: ado2102 <I4O@c#K9B1l6GY0e8!!^0gs>
2021-06-04 14:17:35 -05:00
dependabot[bot] 0b80f23ef2 Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 11:28:58 -05:00
Eric Mann 671b721eed
beck-online: Add online document link (#2341) 2021-06-04 11:26:55 -05:00
Abe Jellinek d9f2915f78 BNF: Support all browsers 2021-06-03 17:23:50 -05:00
placardo b6ffd401da BNF: Linting 2021-06-03 17:23:50 -05:00
placardo 998c605830 BNF: Detect item type from meta tag 2021-06-03 17:23:50 -05:00
Kagami Sascha Rosylight c3efc0193c
Add translator for Daum News (#2372) 2021-06-03 15:06:47 -05:00
Abe Jellinek 52bacd9ccd IMDb: Update for new film page design
<meta> tags are now giving us one fewer top-billed actor, for some
reason, but the changes otherwise weren't substantive.
2021-06-03 14:24:39 -05:00
Bo An b0b60c2ce8
Add translator for Computer History Museum Collections (#2286) 2021-06-03 14:20:27 -05:00
Corey Runkel 2dcc924f34
Add translator for Yale Program on Financial Stability Resource Library (#2358) 2021-06-03 14:14:27 -05:00
Guy Aglionby 1ed8209282
Update ACL translator for new domain (fix #2380) 2021-06-03 10:26:55 -05:00
Diego de la Hera 6377dfe05b Wikidata: Map Q13433827 to encyclopediaArticle item type 2021-06-03 09:22:21 -05:00
Abe Jellinek d147639248 COinS: Lint and update tests 2021-06-03 09:20:36 -05:00
Abe Jellinek 476750ab13 COinS: Optimize detectWeb
Since this translator targets everything, we want a fast `detectWeb`.
This commit removes an unneeded query for every span tag on the page and
replaces an XPath matching on spans' class attribute with a CSS selector
that should be faster in modern browsers.
2021-06-03 09:20:36 -05:00
Mathis EON 92bed747e5 fix: fix lint issue
and removes unnecessary comments
2021-06-02 14:46:09 -05:00
Mathis EON 7c80ee3b0e feature: add URL to online documents
Add URL to online documents for the Sudoc and other catalogs
2021-06-02 14:46:09 -05:00
Abe Jellinek 5af7911bdb Editor support: Fix errors & lint 2021-06-02 14:26:48 -05:00
Abe Jellinek a5ed4a7e2f HeinOnline: Parse DOM to get PDF URL
This replaces the regex that broke recently due to a change in the meta
refresh tag's syntax:
https://forums.zotero.org/discussion/comment/383014/#Comment_383014
2021-06-02 14:07:06 -05:00
Abe Jellinek 21606b5d3d Add translator for Publications Office of the EU
Closes #768; bookshop.europa.eu is now op.europa.eu.
2021-06-02 12:49:10 -05:00
Abe Jellinek f2494798d2 Add (incomplete) API/type defs for TypeScript-aware editors
This doesn't change any translator behavior and doesn't affect Scaffold,
but it makes the editing experience slightly easier in VSCode,
Emacs (with Tide), and other editors that can use TypeScript definitions
to enhance JavaScript editing (providing type hints, warnings for
wrongly-typed arguments, and basic go-to-definition). A future Scaffold
could use them, too.
2021-06-02 12:11:23 -05:00
Abe Jellinek 3f1a1beaef Tumblr: Add search, exclude www., simplify websiteType, update tests 2021-06-02 10:31:35 -05:00
febrezo 4801809a82 Add Tumblr translator 2021-06-02 10:31:35 -05:00
Abe Jellinek 6a599cecb3 Add translator for News Corp Australia sites 2021-06-02 08:44:43 -05:00
Abe Jellinek 19ef6dde30 GameStar/GamePro: Simplify search result selector 2021-06-02 08:39:23 -05:00
Matthias Mailänder f2cfa4489e Add GameStar and GamePro 2021-06-02 08:39:23 -05:00
Abe Jellinek 3b2faa96d3 Wikipedia: Strip tags in page titles, update tests
This fixes the Wikipedia:Article_wizard test, which was previously
returning a title with a bunch of markup in it. Tags that are meaningful
in Zotero titles are preserved.
2021-06-01 18:17:43 -05:00
Abe Jellinek 18fb071ef2 CI: grep_translator_id -> get_translator_id
This use got out of sync with the definition and was causing CI to fail
on PRs with deletions.
2021-06-01 11:44:14 -05:00
Kagami Sascha Rosylight 1091863632 Add a translator for womennews.co.kr 2021-06-01 11:10:27 -05:00
Abe Jellinek aa2cdeb7e4 Embedded Metadata: Strip irrelevant tags in byline
Fixes #2001
2021-06-01 10:00:17 -05:00
Abe Jellinek cd4410cc9a Nature: Update existing tests
(Not broken because of my changes, just out of date.)
2021-06-01 09:55:22 -05:00
Abe Jellinek 1983c56932 Nature: Prefer <meta> journal abbrev.
Fixes #2363. The journal abbreviations that Embedded Metadata gets from
the <meta> tag are correct, and the ones that we get from RIS are no
good.
2021-06-01 09:55:22 -05:00
Abe Jellinek 2b2de18fad CI: Increase fetch depth to 50
Closes #2401.
2021-05-31 19:04:38 -07:00
Abe Jellinek e09dfc2779 Zenodo: Split last-name-only creators; remove Zenodo "institution" 2021-05-31 13:21:42 -07:00
Abe Jellinek 809e397369 Financial Times: Use AMP classes for section
We're probably still not going to get this if we're paywalled, because
it comes from the behind-paywall HTML, but it works well when running in
the browser (and section isn't the most important field).

(defer: true won't change anything here because CI doesn't have access.)
2021-05-28 11:15:48 -07:00
Abe Jellinek 389d15b6ad Financial Times: Use AMP; bylines and abstracts! 2021-05-28 11:15:48 -07:00
Abe Jellinek 9d2a872402 Financial Times: Update metadata 2021-05-28 11:15:48 -07:00
Abe Jellinek 3569f8e1e6 Financial Times: Remove FW, update for current site
The search test will fail on CI. Fixes #1391 and #1075.
2021-05-28 11:15:48 -07:00
Abe Jellinek 6a37332441
GitHub: Cover all repo pages, un-break URL, license, and search (#2393)
Also:

* Update search selector
* Prefer abstract from API, strip when scraped
* Use clipboard-copy value as backup permalink
* Update existing tests
2021-05-28 00:28:58 -04:00
The Open Buddhist University 951c786833 Map "@misc" to Document type 2021-05-27 20:03:17 -07:00
Abe Jellinek 07df344efd Add translator for Taylor & Francis eBooks
Closes #2136
2021-05-27 19:45:54 -07:00
ApoB-100 dbe01265d7 Heise: Add snapshot 2021-05-27 17:19:52 -07:00
Abe Jellinek fdf1895cf2
Add translator for Wiktionary (#2392)
Mostly just calls the Wikipedia translator and tweaks a couple fields.
2021-05-27 02:09:07 -04:00
Abe Jellinek 5de63ff640
CI: Check deleted.txt and lint even if earlier steps fail (#2389)
Unless your `if:` expression contains either `success()` or `failure()`,
GitHub will default to running only on success. We probably can't run
tests if the setup steps fail, but we can usually still lint and check
deleted.txt even if tests fail. It's nice to get as much information as
possible in one CI run when making a PR.
2021-05-26 20:08:15 -04:00
Abe Jellinek e53673b68d Polygon: Lint 2021-05-26 13:05:24 -07:00
Abe Jellinek ed19d777e1 Polygon: Update for 2021 2021-05-26 13:05:24 -07:00
Wolf 27f60fe80e Polygon: Update for 2017 2021-05-26 13:05:24 -07:00
Abe Jellinek 5e72490a73 Digital Spy: Update for current site and lint 2021-05-26 12:46:41 -07:00
owcz 1af5e34ca9 Add Digital Spy.js 2021-05-26 12:46:41 -07:00
Abe Jellinek a913f0c31c Add translator for Adam Matthew Digital collections 2021-05-26 10:17:35 -07:00
Abe Jellinek 814884e4b6 BiblioCommons: Support v2 catalogs
BiblioCommons overhauled the layout of their catalog software at some
point in the past few years, and the translator broke. There's a new URL
format for records and searches and MARC data is displayed a bit
differently. I imagine that there might be some libraries still running
an older version, so the translator just checks for a /v2/ URL.

Closes #766: I tried every site that BiblioCommons lists as a partner
and could find none that still actually use its catalog software but
don't have a *.bibliocommons.com catalog URL.
2021-05-26 09:54:57 -07:00
Abe Jellinek dbaaff93f0 Desiring God: Lint 2021-05-25 21:48:21 -07:00
Luke van der Hoeven 4990427e35 Add translator for Desiring God 2021-05-25 21:48:02 -07:00
Diego de la Hera 7b6aeed506 Wikidata: Fix preexisting linting issues 2021-05-25 11:29:22 -07:00
Diego de la Hera 15061f3a0d Wikidata: Include QID 2021-05-25 11:29:22 -07:00
Abe Jellinek 53cff4dadf Add new Gale translator (replaces Gale Databases)
The Gale Databases translator used to pull Zotero-specific metadata.
This new version uses the RIS they give us instead.
2021-05-25 11:16:02 -07:00
Abe Jellinek 36da2a38b6
Wikipedia: Detect and parse mobile articles (#2377)
Fixes #2366
2021-05-25 06:29:26 -04:00
Dan Stillman 979ccd5d63 CI: Reverse order of tests, with linting last
It's more important to see if translator tests fail than if linting
fails.
2021-05-25 04:32:20 -04:00
Abe Jellinek cd1b276cd1
Merge pull request #2356 from optiprime/heise 2021-05-24 16:54:09 -07:00
Abe Jellinek e720862cb2 Heise.de: Quieter untitled article placeholder 2021-05-24 16:52:52 -07:00
optiprime 457d523d18 Add translator for Heise.de 2021-05-24 16:51:00 -07:00
Abe Jellinek db0648bb7a
Merge pull request #2378 from AbeJellinek/aleph 2021-05-20 21:11:39 -07:00
Abe Jellinek 7dc677b259 Aleph: Linting 2021-05-20 21:10:50 -07:00
Abe Jellinek 6fad5b2adf Aleph: Allow missing slash when detecting MAB2 URL
Fixes #2255. This ended up being simpler than I thought it would be: the
translator already understood that some Aleph records are in MAB2
format, but the URL regex was too restrictive.
2021-05-20 21:10:21 -07:00
Dan Stillman 7aeaea1d12
Merge pull request #2375 from AbeJellinek/muse
Project MUSE: Download full text PDFs
2021-05-19 14:04:41 -04:00
Abe Jellinek a22ab93024 Project MUSE: Download full text PDFs 2021-05-18 23:31:45 -07:00
Dan Stillman dfedb49000 Add attr/text/innerText globals
`attr` and `text` were removed previously, but we should be able to use
them without shims now. See #1913 for details.
2021-05-18 20:58:55 -04:00
Dan Stillman 1dc2ff11bf Twitter: Fix saving from share URLs
Fixes #2369
2021-05-10 00:35:35 -04:00
Dan Stillman b89f99c88a Open WorldCat: Linting 2021-05-07 14:45:07 -04:00
Dan Stillman 5a4e068ff8 Open WorldCat: Strip trailing period from Language and update tests 2021-05-07 14:32:28 -04:00
Dan Stillman 37ef3693c3 Open WorldCat: Fix saving from detail page after single search result
The page markup is invalid, causing the <link> to be interpreted as part
of <body> rather than <head>, so look for just <link> (and switch to
attr()).

(attr()/text() apparently aren't included in search translators, so we
have to bundle that for now.)
2021-05-07 14:31:59 -04:00
Dan Stillman 1d1ce6111a
Merge pull request #2364 from Mailaender/pcgames
Added support for PC Games
2021-04-06 14:44:39 -04:00
Matthias Mailänder a71492f137 Add support for PC Games. 2021-04-06 13:16:49 +02:00
Dan Stillman 16dd2f40f8 Wired: Update some tests and bump timestamp after #2346
One test is still failing due to a missing date, which should be fixed
2021-03-30 15:52:22 -04:00
Dan Stillman 38014cb244
Merge pull request #2346 from danielzgtg/wired
Fix Wired translator
2021-03-30 15:50:08 -04:00
Dan Stillman 3d35a95a2e
Merge pull request #2361 from adomasven/fix-ci-translator-tester
Fix CI translator tester for Chrome 89+ changes
2021-03-29 04:39:25 -04:00
Adomas Venčkauskas de1cc5b15f Fix CI translator tester for Chrome 89+ changes 2021-03-29 11:37:32 +03:00
Dan Stillman 6169f9e2cd Microbiology Society Journals: Fix URLs with query strings
And strip trailing comma in publication titles, which seems to be a
common problem in the RIS
2021-03-17 16:40:06 -04:00
Sebastian Karcher 9a3dcb238f
Merge pull request #2353 from zotero/ebsco-hotfix
EBSCO Hotfix for discovery layer
https://forums.zotero.org/discussion/88250/zotero-connector-does-not-offer-all-sources-in-database-results#latest
2021-03-11 12:32:15 -05:00
Sebastian Karcher d159bbc8d0 EBSCOhost linting 2021-03-11 10:10:14 -05:00
Sebastian Karcher 1c039e7944 EBSCO Hotfix for discovery layer
https://forums.zotero.org/discussion/88250/zotero-connector-does-not-offer-all-sources-in-database-results#latest
2021-03-11 09:09:33 -05:00
Sebastian Karcher f89cf26e91
Merge pull request #2352 from zotero/Stitcher-update
No more nice JSON from Stitcher :(
https://forums.zotero.org/discussion/comment/377338#Comment_377338
2021-03-11 09:03:43 -05:00
Sebastian Karcher 6262e13640 No more nice JSON from Stitcher :( 2021-03-11 08:55:23 -05:00
Sebastian Karcher b881f90349
Merge pull request #2349 from zotero/em-hw-priority
Improves EM item type behavior. Lints.
(tests failing because of translators using EM, but nothing due to this PR)
2021-03-09 23:44:10 -05:00
Sebastian Karcher 5804809cbf EM linting 2021-03-09 23:10:59 -05:00
Sebastian Karcher 14d1dbcf11
Update Hindawi (#2347)
Basically a complete re-write after site re-design
2021-03-07 13:42:58 -05:00
Sebastian Karcher fe4b96686f EM - prioritize HW types
Also some other updates based on tests
2021-03-06 23:22:06 -05:00
Daniel Tang da52111433
Fix Wired translator 2021-03-05 22:36:13 -05:00
Dan Stillman 3ec7895b24
Merge pull request #2251 from dstillman/csl-json-without-type
CSL JSON: Default to 'article' if no 'type'
2021-02-27 06:42:49 -05:00
Dan Stillman 319384d4b1
Merge pull request #2335 from wragge/naa-barcode-fix
Fix for National Archives of Australia barcode change
2021-02-20 01:41:56 -05:00
Tim Sherratt de59fe6ac5 Add new tests for testing 2021-02-13 22:42:53 +11:00
Tim Sherratt 5c7cb6276e Remove tests that fail due to sessions and redirects 2021-02-13 22:07:04 +11:00
Tim Sherratt e94008a7e5 Use item id when scraping photosearch item 2021-02-13 21:11:49 +11:00
Tim Sherratt 2aef6a3549 Change reference to Barcode on item page 2021-02-13 21:03:18 +11:00
Dan Stillman 573a963d31
Merge pull request #2333 from bkawula/master
Updated header tag in xpath for Scholars Portal Journals
2021-02-05 13:30:32 -05:00
bartek kawula 19fbfc73ae updated header tag in xpath 2021-02-05 13:26:22 -05:00
Sebastian Karcher eb98401a7e
Education Week: Complete re-write (#2329) 2021-02-03 22:45:16 -05:00
Dan Stillman d8613471a5 CI: Fix fetching of history for pull requests 2021-02-03 17:08:42 -05:00
Dan Stillman 888de7626c Revert "CI: Fix "parent_commits: unbound variable""
This reverts commit 4a23fb5d82.
2021-02-03 05:04:35 -05:00
Dan Stillman 4a23fb5d82 CI: Fix "parent_commits: unbound variable" 2021-02-03 02:57:17 -05:00
Dan Stillman 1397e32011 CI: Debugging for get_translators_to_check 2021-02-02 08:09:59 -05:00
Dan Stillman e49fcb8973 CI: Another attempt to fail on errors in get_translators_to_check
set -e is worthless
2021-02-02 08:08:56 -05:00
Dan Stillman d968b5cdf2 CI: Fix error on master, hopefully 2021-01-31 23:42:35 -05:00
Dan Stillman cfe7c510cd CI: Try a different approach to fetching additional history 2021-01-31 23:27:44 -05:00
Dan Stillman 1fbd2fd5a9 Add -uo pipefail for CI scripts
And switch to || true instead of | true

Necessary to stop on errors in pipes in get_translators_to_check
2021-01-31 23:27:17 -05:00
Dan Stillman d50a2dadd4 CI: Fetch additional history twice
For some reason the first `git fetch --depth=25` sometimes isn't
working to fetch additional history on the shallow clone. No idea why
not.
2021-01-30 18:03:48 -05:00
Dan Stillman e7432cf1ea CI: Bail on failure to get translators to check
Wrap grep so that we can use -e for check-pull-request.sh and lint.sh
2021-01-30 18:03:35 -05:00
Dan Stillman 169ea8d2d5 GitHub Actions: Fix pushes to master and commits without JS files 2021-01-30 09:03:25 -05:00
Dan Stillman d44ebd8635 CSL JSON: Default to 'article' if no 'type'
'type' is required in CSL-JSON, but some DOI registration agencies
provide bad data, and this is better than failing. (itemFromCSLJSON()
will already default to 'article' for unknown 'type' values.)

Technically this should go in the DOI Content Negotation translator, but
it's easier to do this here after the JSON has been parsed, and it might
benefit other translators.

This is just for imports from other translators. File/clipboard imports
without 'type' still won't work, because a valid 'type' is required in
detectImport(). (This also can't be tested in Scaffold, which does a
detect first.)

https://forums.zotero.org/discussion/85273/error-importing-dois-via-add-item-by-identifier
2020-09-23 00:41:06 -04:00
563 changed files with 136700 additions and 32946 deletions

View File

@ -4,7 +4,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "$SCRIPT_DIR/helper.sh"
cd "$SCRIPT_DIR"
MASTER="origin/master"
MASTER="master"
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" = "$MASTER" ]];then
@ -25,7 +25,7 @@ main() {
deletions+=($(git diff-index --diff-filter=D --name-only --find-renames $MASTER|grep -v '\.ci'|grep 'js$'))
if (( ${#deletions[@]} > 0 ));then
for f in "${deletions[@]}";do
local id=$(git show $MASTER:"$f" | grep_translator_id)
local id=$(git show $MASTER:"$f" | get_translator_id)
if ! grep -qF "$id" '../deleted.txt';then
echo "${color_notok}not ok${color_reset} - $id ($f) should be added to deleted.txt"
(( failed += 1))

View File

@ -2,110 +2,8 @@
'use strict';
const fs = require('fs');
const path = require('path');
const find = require('recursive-readdir-synchronous');
const CLIEngine = require("eslint").CLIEngine;
const argv = require('commander');
const translators = require('../lib/translators');
process.argv = process.argv.map(arg => arg === '--output-json' ? [ '--format', 'json', '--output-file' ] : arg).flat();
argv
.version(CLIEngine.version)
.option('-f, --fix', 'Automatically fix problems')
.option('--no-ignore', 'Disable use of ignore files and patterns')
.option('--quiet', 'Report errors only - default: false')
.option('--dump-decorated [file]', 'Dump decorated translator to file for inspection')
.parse(process.argv);
/* PATCHES */
// disable the processor so that fixing works
const eslintPluginZoteroTranslator = require('eslint-plugin-zotero-translator');
delete eslintPluginZoteroTranslator.processors;
/* MAIN */
// split sources to lint into regular javascript (handled by executeOnFiles) and translators (handled by executeOnText)
const sources = {
javascripts: [],
translators: [],
errors: 0,
};
function findIgnore(file, stats) {
if (stats.isDirectory()) return (path.basename(file) == "node_modules");
return !file.endsWith('.js');
}
for (const target of argv.args) {
if (!fs.existsSync(target)) continue;
const files = fs.lstatSync(target).isDirectory() ? find(target, [findIgnore]) : [target];
for (const file of files) {
if (path.dirname(path.resolve(file)) === translators.cache.repo) {
const translator = translators.cache.get(file);
if (translator.header) {
translator.filename = file;
sources.translators.push(translator);
}
else {
sources.javascripts.push(file);
}
}
else {
sources.javascripts.push(file);
}
}
}
const cli = new CLIEngine({
cwd: translators.cache.repo,
fix: argv.fix,
ignore: argv.ignore, // otherwise you can't lint stuff in hidden dirs
});
const formatter = cli.getFormatter();
function showResults(files, results) {
if (argv.quiet) results = CLIEngine.getErrorResults(results);
for (const res of results) {
sources.errors += res.errorCount;
}
if (results.length) {
console.log(formatter(results)); // eslint-disable-line no-console
}
else {
if (Array.isArray(files)) files = files.join(', ');
if (!argv.quiet) console.log(files, 'OK'); // eslint-disable-line no-console
}
}
if (sources.javascripts.length) {
const report = cli.executeOnFiles(sources.javascripts);
if (argv.fix) {
for (const result of report.results) {
if (result.messages.find(msg => msg.ruleId === 'notice/notice' && msg.fix)) {
console.log(`Not safe to apply 'notice/notice' to ${result.filePath}`); // eslint-disable-line no-console
process.exit(1); // eslint-disable-line no-process-exit
}
}
CLIEngine.outputFixes(report);
}
showResults(sources.javascripts, report.results);
}
for (const translator of sources.translators) {
if (argv.dumpDecorated) fs.writeFileSync(argv.dumpDecorated, translator.source, 'utf-8');
const report = cli.executeOnText(translator.source, translator.filename);
if (argv.fix) {
for (const result of report.results) {
if (result.output) {
try {
fs.writeFileSync(result.filePath, translators.strip(result.output), 'utf-8');
}
catch (err) {
console.log(`Error writing fixed ${result.filePath}: ${err.message}`); // eslint-disable-line no-console
process.exit(1); // eslint-disable-line no-process-exit
}
}
}
}
showResults(translator.filename, report.results);
}
process.exit(sources.errors); // eslint-disable-line no-process-exit
require('../../../node_modules/.bin/eslint')

View File

@ -10,6 +10,6 @@ const requireDir = require('require-dir');
module.exports = {
rules: requireDir('./lib/rules'),
processors: {
'.js': require('./lib/processor'),
}
translator: require('./processor'),
},
};

View File

@ -1,15 +0,0 @@
'use strict';
const translators = require('../translators').cache;
module.exports = {
preprocess: function (text, filename) {
const translator = translators.get(filename);
return [(typeof translator.source === 'string') ? translator.source : text];
},
postprocess: function (messages, _filename) {
return messages[0];
},
};

View File

@ -0,0 +1,55 @@
'use strict';
const { parsed, header } = require('../../processor').support;
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'enforce valid lastUpdated in header',
category: 'Possible Errors',
},
fixable: 'code',
},
create: function (context) {
return {
Program: function (node) {
const filename = context.getFilename();
const translator = parsed(filename);
if (!translator || !translator.header.fields) return; // regular js source, or header is invalid
const lastUpdated = header(node).properties.find(p => p.key.value === 'lastUpdated');
if (!lastUpdated) {
context.report({
loc: { start: { line: 1, column: 1 } },
message: 'Header needs lastUpdated field',
});
return;
}
const format = date => date.toISOString().replace('T', ' ').replace(/\..*/, '');
const now = format(new Date());
const fix = fixer => fixer.replaceText(lastUpdated.value, `"${now}"`);
if (typeof lastUpdated.value.value !== 'string' || !lastUpdated.value.value.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/)) {
context.report({
node: lastUpdated.value,
message: `lastUpdated field must be a string in YYYY-MM-DD HH:MM:SS format`,
fix,
});
return;
}
if (translator.lastUpdated && translator.lastUpdated > lastUpdated.value.value) {
context.report({
node: lastUpdated.value,
message: `lastUpdated field must be updated to be > ${translator.lastUpdated} to push to clients`,
fix,
});
}
}
};
},
};

View File

@ -0,0 +1,65 @@
'use strict';
const fs = require('fs');
const path = require('path');
const uuid = require('uuid/v4');
const { repo, parsed, header, IDconflict } = require('../../processor').support;
const deleted = new Set(
fs.readFileSync(path.join(repo, 'deleted.txt'), 'utf-8')
.split('\n')
.map(line => line.split(' ')[0])
.filter(id => id && id.indexOf('-') > 0)
);
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallows translatorID re-use',
category: 'Potential Problems',
},
fixable: 'code',
},
create: function (context) {
return {
Program: function (node) {
const filename = context.getFilename();
const translator = parsed(filename);
if (!translator || !translator.header.fields) return; // regular js source, or header is invalid
const translatorID = header(node).properties.find(p => p.key.value === 'translatorID');
if (!translatorID || !translatorID.value.value) {
context.report({
node: header(node),
message: 'Header has no translator ID',
});
return;
}
if (deleted.has(translatorID.value.value)) {
context.report({
node: translatorID.value,
message: 'Header re-uses translator ID of deleted translator',
fix: function (fixer) {
return fixer.replaceText(translatorID.value, `"${uuid()}"`);
}
});
return;
}
const conflict = IDconflict(filename);
if (conflict) {
context.report({
node: translatorID.value,
message: `re-uses translator ID of ${conflict.label}`,
fix: fixer => fixer.replaceText(translatorID.value, `"${uuid()}"`),
});
}
}
};
}
};

View File

@ -0,0 +1,82 @@
'use strict';
const { parsed } = require('../../processor').support;
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'enforce translatorType against handler functions',
category: 'Possible Errors',
},
},
create: function (context) {
return {
Program: function (program) {
const translator = parsed(context.getFilename());
if (!translator || !translator.header.fields) return; // regular js source, or header is invalid
const functions = program.body.map((node) => {
if (node.type === 'FunctionDeclaration') return node.id && node.id.name;
if (node.type === 'VariableDeclaration'
&& node.declarations.length === 1
&& node.declarations[0].init
&& node.declarations[0].init.type === 'FunctionExpression') {
return node.declarations[0].id.name;
}
return null;
})
.filter(name => name);
const type = {
import: 1,
export: 2,
web: 4,
search: 8
};
const translatorType = translator.header.fields.translatorType;
const browserSupport = translator.header.fields.browserSupport;
if (browserSupport && !(translatorType & type.web)) {
context.report({
loc: { start: { line: 1, column: 1 } },
message: `browserSupport set, but translatorType (${translatorType}) does not include web (${type.web})`,
});
return;
}
for (const name of ['detectWeb', 'doWeb', 'detectImport', 'doImport', 'doExport', 'detectSearch', 'doSearch']) {
const handler = functions.includes(name);
const mode = name.replace(/^(detect|do)/, '').toLowerCase();
const bit = type[mode];
if (handler && !(translatorType & bit)) {
context.report({
loc: { start: { line: 1, column: 1 } },
message: `${name} present, but translatorType (${translatorType}) does not specify ${mode} (${bit})`,
});
return;
}
if (!handler && (translatorType & bit)) {
let message = `translatorType specifies ${mode} (${bit}), but no ${name} present`;
if (translatorType & type.web && mode !== 'web') {
// Lots of common errors involve web translator developers not understanding
// translator type jargon and checking too many boxes - checking "search"
// because the translator supports search pages, or "import" because it
// imports items from the site.
// Be extra explicit when it seems like that might be the situation.
message += `. This web translator is probably NOT a${bit <= 2 ? 'n' : ''} ${mode} translator, `
+ `even if it supports "${mode}" pages or "${mode}ing". Uncheck "${mode}" in Scaffold.`;
}
context.report({
loc: { start: { line: 1, column: 1 } },
message,
});
return;
}
}
}
};
},
};

View File

@ -1,6 +1,6 @@
'use strict';
const translators = require('../translators').cache;
const { parsed, json } = require('../../processor').support;
module.exports = {
meta: {
@ -14,14 +14,15 @@ module.exports = {
create: function (context) {
return {
Program: function (_node) {
const translator = translators.get(context.getFilename());
const translator = parsed(context.getFilename());
if (!translator.source) return; // regular js source
if (!translator || translator.header.fields) return; // regular js source, or header is valid json
if (translator.header.error) {
const err = json.try(translator.header.text, { line: 0, position: 1 });
if (err) {
context.report({
message: `Could not parse header: ${translator.header.error.message}`,
loc: { start: { line: translator.error.line, column: translator.error.column } },
message: `Could not parse header: ${err.message}`,
loc: { start: { line: err.line, column: err.column } },
});
}
}

View File

@ -1,47 +0,0 @@
'use strict';
const translators = require('../translators').cache;
const getHeaderFromAST = require('../translators').getHeaderFromAST;
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'enforce valid lastUpdated in header',
category: 'Possible Errors',
},
fixable: 'code',
},
create: function (context) {
return {
Program: function (node) {
const header = getHeaderFromAST(node);
if (!header.declaration) return;
const translator = translators.get(context.getFilename());
const updated = (new Date)
.toISOString()
.replace('T', ' ')
.replace(/\..*/, '');
if (!header.properties.lastUpdated) {
context.report({
node: header.declaration,
message: 'Header needs lastUpdated field'
});
}
else if (translator.lastUpdated && translator.lastUpdated >= header.properties.lastUpdated.value) {
context.report({
node: header.properties.lastUpdated,
message: `lastUpdated field must be updated to be > ${translator.lastUpdated} to push to clients`,
fix: function (fixer) {
return fixer.replaceText(header.properties.lastUpdated, `"${updated}"`);
},
});
}
}
};
},
};

View File

@ -1,6 +1,6 @@
'use strict';
const translators = require('../translators');
const { parsed } = require('../../processor').support;
const findRoot = require("find-root");
const fs = require('fs');
const path = require('path');
@ -18,69 +18,63 @@ module.exports = {
create: function (context) {
return {
Program: function (node) {
const header = translators.getHeaderFromAST(node);
if (!header.body) return; // if there's no file header, assume it's not a translator
if (!header.followingStatement) return; // if there's no following statement, there's more significant problems than just the license missing
const translator = parsed(context.getFilename());
if (!translator) return; // regular js source
if (node.body.length < 2) return; // no body?
const options = context.options[0];
if (!options.mustMatch) throw new Error('mustMatch not set');
if (!options.mustMatch) throw new Error('license/mustMatch not set');
if (!options.templateFile) throw new Error('license/templateFile not set');
let firstComment = null;
let copyright = null;
for (const comment of context.getSourceCode().getAllComments()) {
if (comment.loc.start.line <= header.body.loc.end.line) continue; // skip decorator comments
const license = context.getSourceCode().getAllComments().find((comment) => {
return comment.type === 'Block' && comment.value.match(/(BEGIN LICENSE BLOCK[\s\S]+END LICENSE BLOCK)|(Copyright)/i);
});
if (comment.value.includes(options.mustMatch)) {
if (firstComment || comment.loc.start.line > header.followingStatement.start.line) {
context.report({
loc: comment.loc,
message: 'Preferred to have license block at the top'
});
}
return;
if (!license) {
const properties = translator.header.fields;
const copyright = {
holder: properties.creator || 'Zotero Contributors',
period: `${(new Date).getFullYear()}`,
};
if (properties.lastUpdated) {
const year = properties.lastUpdated.split('-')[0] || '';
if (year && year !== copyright.period) copyright.period = `${year}-${copyright.period}`;
}
if (comment.value.match(/copyright/i)) {
copyright = comment;
}
const templateFile = fs.existsSync(options.templateFile)
? options.templateFile
: path.resolve(path.join(findRoot(context.getFilename()), options.templateFile));
if (!fs.existsSync(templateFile)) throw new Error(`cannot find ${templateFile}`);
const template = fs.readFileSync(templateFile, 'utf-8');
firstComment = firstComment || comment;
}
if (copyright) {
const licenseText = '\n\n' + template.trim().replace(/\${(.*?)\}/g, (_, id) => {
id = id.trim();
return copyright[id] || `<undefined '${id}'>`;
}) + '\n\n';
context.report({
loc: copyright.loc,
message: `Copyright preferred to be ${options.mustMatch}`,
message: 'Missing license block',
loc: node.body[1].loc.start,
fix: fixer => fixer.insertTextBefore(node.body[1], licenseText),
});
return;
}
if (!options.templateFile) throw new Error('templateFile not set');
const templateFile = fs.existsSync(options.templateFile)
? options.templateFile
: path.resolve(path.join(findRoot(context.getFilename()), options.templateFile));
if (!fs.existsSync(templateFile)) throw new Error(`cannot find ${templateFile}`);
const template = fs.readFileSync(templateFile, 'utf-8');
copyright = {
holder: header.properties.creator ? header.properties.creator.value : null,
period: `${(new Date).getFullYear()}`,
};
if (header.properties.lastUpdated) {
const year = header.properties.lastUpdated.value.split('-')[0] || '';
if (year && year !== copyright.period) copyright.period = `${year}-${copyright.period}`;
if (node.body.length > 2 && node.body[1].loc.start.line < license.loc.start.line) {
context.report({
loc: license.loc,
message: 'Preferred to have license block at the top'
});
return;
}
const licenseText = '\n\n' + template.trim().replace(/\${(.*?)\}/g, (_, id) => {
id = id.trim();
return copyright[id] || `<undefined '${id}'>`;
}) + '\n\n';
context.report({
node: header.followingStatement,
message: "Missing license block",
fix: (firstComment && firstComment.type === 'Block')
? undefined
: fixer => fixer.insertTextBefore(header.followingStatement, licenseText),
});
if (!license.value.match(new RegExp(options.mustMatch))) {
context.report({
loc: license.loc,
message: `Copyright preferred to be ${options.mustMatch}`,
});
}
}
};
},

View File

@ -12,7 +12,7 @@ module.exports = {
create: function (context) {
return {
Program: function (node) {
Program: function (_node) {
let lineno = 0;
for (const line of context.getSourceCode().getText().split('\n')) {
lineno += 1;
@ -20,7 +20,6 @@ module.exports = {
const m = line.match(/for each *\(/);
if (m) {
context.report({
node,
message: "Deprecated JavaScript 'for each' statement",
loc: { start: { line: lineno, column: line.indexOf(m[0]) + 1 } },
});

View File

@ -3,7 +3,7 @@
const fs = require('fs');
const path = require('path');
const translators = require('../translators').cache;
const { parsed } = require('../../processor').support;
module.exports = {
meta: {
@ -17,11 +17,10 @@ module.exports = {
create: function (context) {
return {
Program: function (node) {
const translator = translators.get(context.getFilename());
if (!translator.source) return; // only check translators
if (process.platform == 'win32') return; // X_OK always succeeds on Windows
const filename = context.getFilename();
if (!parsed(filename)) return; // only check translators
try {
fs.accessSync(filename, fs.constants.X_OK);

View File

@ -1,30 +1,45 @@
'use strict';
// this is a very simplistic rule to find 'unnecessary use of indexOf' until I find a better eslint plugin that does this
module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'suggest alternative to unnecessary use of indexOf',
description: 'suggest alternative to unnecessary use of indexOf or search',
category: 'Stylistic Issues',
},
fixable: 'code',
},
create: function (context) {
return {
Program: function (node) {
let lineno = 0;
for (const line of context.getSourceCode().getText().split('\n')) { // eslint-disable-line newline-per-chained-call
lineno += 1;
const m = line.match(/\.indexOf(.*) *(=+ *-1|!=+ *-1|> *-1|>= *0|< *0)/);
if (m) {
context.report({
node,
message: "Unnecessary '.indexOf()', use '.includes()' instead",
loc: { start: { line: lineno, column: line.indexOf(m[0]) + 1 } },
});
}
"BinaryExpression > CallExpression:matches([callee.property.name='indexOf'], [callee.property.name='search'])[arguments.length=1]": (node) => {
let source = context.getSourceCode();
let binary = node.parent;
if (
(binary.operator.startsWith('==')
|| binary.operator.startsWith('!=')
|| binary.operator === '>') && source.getText(binary.right) === '-1'
|| (binary.operator === '<' || binary.operator === '>=') && source.getText(binary.right) === '0'
) {
context.report({
node,
message: node.callee.property.name === 'indexOf'
? "Unnecessary '.indexOf()', use '.includes()' instead"
: "Unnecessary '.search()', use 'RegExp#test()' instead",
* fix(fixer) {
let test = node.callee.property.name === 'indexOf'
? `${source.getText(node.callee.object)}.contains(${source.getText(node.arguments[0])})`
: `${source.getText(node.arguments[0])}.test(${source.getText(node.callee.object)})`;
let positiveMatch = binary.operator.startsWith('!=')
|| binary.operator === '>'
|| binary.operator === '>=';
if (!positiveMatch) {
// This might produce unnecessary parens, but unfortunately it's the best we can do
test = `!(${test})`;
}
yield fixer.replaceText(binary, test);
}
});
}
}
};

View File

@ -0,0 +1,43 @@
'use strict';
module.exports = {
meta: {
type: 'suggest',
docs: {
description: 'suggest alternatives to brittle querySelector() strings',
},
fixable: 'code',
},
create: function (context) {
return {
"CallExpression:matches([callee.property.name=/querySelector(All)?/], [callee.name=/attr|text|innerText/])[arguments.0.type=Literal]": (node) => {
let arg = node.arguments[0].raw;
if (typeof arg !== 'string') {
return;
}
let idRe = /\[id=(["'])([^"'.#\s]+)\1]/g;
if (idRe.test(arg)) {
context.report({
node,
message: "Prefer #id over [id=\"id\"]",
* fix(fixer) {
yield fixer.replaceText(node.arguments[0], arg.replaceAll(idRe, "#$2"));
}
});
}
let classRe = /\[class=(["'])([^"'.#]+)\1]/g;
if (classRe.test(arg)) {
context.report({
node,
message: "Prefer .class over [class=\"class\"]",
* fix(fixer) {
yield fixer.replaceText(node.arguments[0],
arg.replaceAll(classRe, (_, __, name) => `.${name.replaceAll(/\s+/g, '.')}`));
}
});
}
}
};
},
};

View File

@ -1,30 +0,0 @@
'use strict';
const translators = require('../translators').cache;
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow invalid JSON in test cases',
category: 'Possible Errors',
},
},
create: function (context) {
return {
Program: function (_node) {
const translator = translators.get(context.getFilename());
if (!translator.testCases) return; // regular js or no test cases
if (translator.testCases.error) {
context.report({
message: `Could not parse testCases: ${translator.testCases.error.message}`,
loc: { start: { line: translator.testCases.error.line, column: translator.testCases.error.column } },
});
}
}
};
},
};

View File

@ -1,14 +1,29 @@
'use strict';
const translators = require('../translators').cache;
const astUtils = require("eslint/lib/util/ast-utils");
const { parsed, json } = require('../../processor').support;
function zip(arrays) {
let zipped = null;
for (const [key, array] of Object.entries(arrays)) {
if (!zipped) {
zipped = Array(array.length).fill(null).map((_, i) => ({ _: i }));
}
else if (array.length !== zipped.length) {
throw new Error(`Array length mismatch: ${key} has ${array.length} elements, but ${zipped.length} expected`);
}
for (const [i, value] of array.entries()) {
zipped[i][key] = value;
}
}
return zipped;
}
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow invalid test input',
description: 'disallow invalid tests',
category: 'Possible Errors',
},
},
@ -16,79 +31,154 @@ module.exports = {
create: function (context) {
return {
Program: function (node) {
const translator = translators.get(context.getFilename());
const translator = parsed(context.getFilename());
if (!translator || !translator.testcases.text) return; // regular js source, or no testcases
const declaration = node.body.find(node => node.type === 'VariableDeclaration' && node.declarations.length === 1 && node.declarations[0].id.name === 'testCases');
const testCases = declaration
&& declaration.declarations[0].init
&& declaration.declarations[0].init.type === 'ArrayExpression'
? declaration.declarations[0].init.elements
: [];
if (declaration) {
const sourceCode = context.getSourceCode();
if (astUtils.isSemicolonToken(sourceCode.getLastToken(node))) {
context.report({
message: 'testcases should not have trailing semicolon',
loc: declaration.loc.end,
});
}
const err = json.try(translator.testcases.text, { line: translator.testcases.start, position: 3 });
if (err) {
context.report({
message: `Could not parse testcases: ${err.message}`,
loc: { start: { line: err.line, column: err.column } },
});
return;
}
if (!translator.testCases || translator.testCases.error) return; // regular js or no test cases
const declaration = node.body.find(node => (
node.type === 'VariableDeclaration'
&& node.declarations.length === 1
&& node.declarations[0].id.name === 'testCases'
));
if (declaration.followingStatement) {
context.report({
node: declaration.followingStatement,
message: 'testCases should not have trailing code',
});
}
let caseNo = -1;
for (const testCase of translator.testCases.parsed) {
caseNo += 1;
const prefix = `test case${testCases[caseNo] ? '' : ' ' + (caseNo + 1)}`;
const loc = testCases[caseNo] ? testCases[caseNo].loc.start : { start: { line: translator.testCases.start, column: 1 } };
const nodes = declaration.declarations[0].init.elements;
if (!Array.isArray(nodes)) {
context.report({
node: declaration,
message: 'testCases must be an array',
});
return;
}
const sourceCode = context.getSourceCode();
const token = sourceCode.getLastToken(node);
if (token.type === 'Punctuator' && token.value === ';') {
context.report({
message: 'testCases should not have trailing semicolon',
loc: declaration.loc.end,
});
}
zip({
testCase: JSON.parse(translator.testcases.text),
node: nodes,
})
.forEach(({ testCase, node }) => {
if (!['web', 'import', 'search'].includes(testCase.type)) {
context.report({
message: `${prefix} has invalid type "${testCase.type}"`,
loc,
node,
message: `test case has invalid type "${testCase.type}"`,
});
continue;
return;
}
if (!(Array.isArray(testCase.items) || (testCase.type === 'web' && testCase.items === 'multiple'))) {
context.report({
message: `${prefix} of type "${testCase.type}" needs items`,
loc,
node,
message: `test case of type "${testCase.type}" needs items`,
});
}
if (testCase.type === 'web' && typeof testCase.url !== 'string') {
context.report({
message: `${prefix} of type "${testCase.type}" test needs url`,
loc,
node,
message: `test case of type "${testCase.type}" test needs url`,
});
}
if (['import', 'search'].includes(testCase.type) && !testCase.input) {
context.report({
message: `${prefix} of type "${testCase.type}" needs a string input`,
loc,
node,
message: `test case of type "${testCase.type}" needs a string input`,
});
}
else if (testCase.type === 'import' && typeof testCase.input !== 'string') {
context.report({
message: `${prefix} of type "${testCase.type}" needs input`,
loc,
node,
message: `test case of type "${testCase.type}" needs input`,
});
}
else if (testCase.type === 'search') {
// console.log(JSON.stringify(testCase.input))
const term = Object.keys(testCase.input).join('/');
const expected = ['DOI', 'ISBN', 'PMID', 'identifiers', 'contextObject'];
if (!expected.includes(term)) {
const expected = ['DOI', 'ISBN', 'PMID', 'arXiv', 'identifiers', 'contextObject', 'adsBibcode', 'ericNumber', 'openAlex'];
let keys;
if (Array.isArray(testCase.input)) {
keys = testCase.input.flatMap(Object.keys);
}
else {
keys = Object.keys(testCase.input);
}
if (!keys.every(key => expected.includes(key))) {
const invalidKey = keys.find(key => !expected.includes(key));
context.report({
message: `${prefix} of type "${testCase.type}" has search term '${term}', expected one of ${expected.join(', ')}`,
loc,
node,
message: `test case of type "${testCase.type}" has invalid search term '${invalidKey}' - expected one of ${expected.join(', ')}`,
});
}
}
}
if (Array.isArray(testCase.items)) {
zip({
item: testCase.items,
node: node.properties.find(prop => prop.key.type === 'Literal' && prop.key.value === 'items').value.elements,
})
.forEach(({ item, node }) => {
if (!Array.isArray(item.creators)) {
context.report({
message: 'creators should be an array',
node,
});
return;
}
zip({
creator: item.creators,
node: node.properties.find(prop => prop.key.type === 'Literal' && prop.key.value === 'creators').value.elements,
})
.forEach(({ creator, node }) => {
if (creator.fieldMode !== undefined && creator.fieldMode !== 1) {
context.report({
node,
message: 'creator.fieldMode should be omitted or 1',
});
}
else if (creator.fieldMode === 1 && (creator.firstName || !creator.lastName)) {
context.report({
node,
message: 'creator with fieldMode == 1 should have lastName and no firstName',
});
}
else if (!creator.firstName && !creator.lastName) {
context.report({
node,
message: 'creator has no name',
});
}
if (!creator.creatorType) {
context.report({
node,
message: 'creator has no creatorType',
});
}
});
});
}
});
}
};
},

View File

@ -1,6 +1,6 @@
'use strict';
const translators = require('../translators');
const { parsed } = require('../../processor').support;
module.exports = {
meta: {
@ -14,19 +14,14 @@ module.exports = {
create: function (context) {
return {
Program: function (node) {
const header = translators.getHeaderFromAST(node);
if (!header.body) return; // if there's no file header, assume it's not a translator
Program: function (_node) {
const translator = parsed(context.getFilename());
if (!translator || !translator.FW) return; // regular js source, or no FW present
const sourceCode = context.getSourceCode();
for (const comment of sourceCode.getAllComments()) {
if (comment.value.match(/^\s*FW LINE [0-9]+:/)) {
context.report({
loc: comment.loc,
message: 'uses deprecated Translator Framework'
});
}
}
context.report({
loc: translator.FW.loc,
message: 'uses deprecated Translator Framework'
});
}
};
},

View File

@ -1,69 +0,0 @@
'use strict';
const fs = require('fs');
const path = require('path');
const uuid = require('uuid/v4');
const translators = require('../translators').cache;
const getHeaderFromAST = require('../translators').getHeaderFromAST;
const deleted = new Set(
fs.readFileSync(path.join(translators.repo, 'deleted.txt'), 'utf-8')
.split('\n')
.map(line => line.split(' ')[0])
.filter(id => id && id.indexOf('-') > 0)
);
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallows translatorID re-use',
category: 'Potential Problems',
},
fixable: 'code',
},
create: function (context) {
return {
Program: function (node) {
const filename = context.getFilename();
const header = getHeaderFromAST(node);
if (!header.declaration) return;
if (!header.properties.translatorID) {
context.report({
node: header.declaration,
message: 'Header has no translator ID',
});
}
else if (deleted.has(header.properties.translatorID.value)) {
context.report({
node: header.properties.translatorID,
message: 'Header re-uses translator ID of deleted translator',
fix: function (fixer) {
return fixer.replaceText(header.properties.translatorID, `"${uuid()}"`);
}
});
}
else if (!header.properties.translatorID.value) {
context.report({
node: header.properties.translatorID,
message: 'Header has empty translator ID',
});
}
else {
const conflict = translators.conflicts(filename, header.properties.translatorID.value);
if (conflict) {
const translator = translators.get(filename);
context.report({
node: header.properties.translatorID,
message: `Header re-uses translator ID of ${conflict.label}`,
fix: !translator.modified ? undefined : (fixer => fixer.replaceText(header.properties.translatorID, `"${uuid()}"`)),
});
}
}
}
};
},
};

View File

@ -1,72 +0,0 @@
'use strict';
const getHeaderFromAST = require('../translators').getHeaderFromAST;
function getFunction(programNode, name) {
return programNode.body.find((node) => {
if (node.type === 'FunctionDeclaration' && node.id && node.id.name === name) return true;
if (node.type === 'VariableDeclaration'
&& node.declarations.length === 1
&& node.declarations[0].id.name === name
&& node.declarations[0].init
&& node.declarations[0].init.type === 'FunctionExpression'
) return true;
return false;
});
}
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'enforce translatorType against handler functions',
category: 'Possible Errors',
},
},
create: function (context) {
return {
Program: function (node) {
const header = getHeaderFromAST(node);
if (!header.declaration) return;
const type = {
import: 1,
export: 2,
web: 4,
search: 8
};
let translatorTypeNode = header.declaration;
let translatorType = 0;
let browserSupportNode = null;
for (const [p, v] of Object.entries(header.properties)) {
switch (p) {
case 'translatorType':
translatorTypeNode = v;
translatorType = v.value;
break;
case 'browserSupport':
browserSupportNode = v;
break;
}
}
if (browserSupportNode && !(translatorType & type.web)) context.report(browserSupportNode, `browserSupport set, but translatorType (${translatorType}) does not include web (${type.web})`);
for (const name of ['detectWeb', 'doWeb', 'detectImport', 'doImport', 'doExport']) {
const handler = getFunction(node, name);
const mode = name.replace(/^(detect|do)/, '').toLowerCase();
const bit = type[mode];
if (handler && !(translatorType & bit)) {
context.report(handler, `${name} present, but translatorType (${translatorType}) does not specify ${mode} (${bit})`);
}
if (!handler && (translatorType & bit)) {
context.report(translatorTypeNode, `translatorType specifies ${mode} (${bit}), but no ${name} present`);
}
}
}
};
},
};

View File

@ -1,249 +0,0 @@
'use strict';
const fs = require('fs');
const path = require('path');
const findRoot = require('find-root');
const childProcess = require('child_process');
const repo = path.resolve(findRoot(__dirname, dir => fs.existsSync(path.resolve(dir, '.git'))));
const metaDataRules = [
'zotero-translator/header-valid-json',
'zotero-translator/last-updated',
'zotero-translator/translator-id',
'zotero-translator/test-cases-valid-json',
'zotero-translator/test-cases',
'zotero-translator/translator-type',
'zotero-translator/prefer-index-of',
'zotero-translator/no-for-each',
'zotero-translator/not-executable',
'indent',
].join(', ');
const headerVar = '__eslintZoteroTranslatorHeader';
const headerPrefix = `/* eslint-disable no-unused-vars */ const ${headerVar} = /* eslint-disable */(/* eslint-enable ${metaDataRules} */`;
function jsonParseWithErrorInfo(raw, source) {
const target = { raw };
target.lines = target.raw.split('\n').length;
try {
target.parsed = JSON.parse(target.raw);
}
catch (err) {
const position = err.message.match(/at position ([0-9]+)/);
const at = position ? parseInt(position[1]) : 0;
target.error = {
message: err.message,
line: source.substring(0, source.indexOf(raw)).split('\n').length // start of raw JSON
+ target.raw.substring(0, at).split('\n').length, // line within raw JSON
column: at - target.raw.lastIndexOf('\n', at),
};
}
return target;
}
function escapeRE(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
const re = {
undecorated: new RegExp(
/^(\{[\s\S]+?\n\})/.source // the header
+ /(\n[\s\S]+?)/.source // the code
+ '(?:' // test cases
+ /(\/\*\* BEGIN TEST CASES \*\*\/)([\s\S]+?)/.source // var testCases =
+ /(\[[\s\S]+\])/.source // the test cases
+ /([\s\S]+)/.source // trailing stuff after the test cases
+ ')?$' // test cases are optional
),
decorated: new RegExp(
/^([\s\S]*?)/.source // anything the fixer might have placed at the top
+ escapeRE(headerPrefix) // all the eslint junk we injected
+ /(\{[\s\S]+\})/.source // the header
+ escapeRE(');/* eslint-enable */') // more eslint stuff we injected
+ /([\s\S]+?)/.source // the code
+ '(?:' // optional test cases
+ /(\/\*\* BEGIN TEST CASES \*\*\/)/.source
+ escapeRE('/* eslint-disable */') // more eslint stuff we injected
+ /([\s\S]+?)/.source // var testCases =
+ escapeRE(`/* eslint-enable ${metaDataRules} */`)
+ /([\s\S]+)/.source
+ ')?$'
),
};
const tfw = {
rules: [
'block-spacing',
'brace-style',
'comma-spacing',
'consistent-return',
'consistent-this',
'key-spacing',
'keyword-spacing',
'no-array-constructor',
'no-cond-assign',
'no-new-object',
'no-sequences',
'no-undef',
'no-unused-expressions',
'no-void',
'object-curly-spacing',
'semi',
'semi-spacing',
'space-before-blocks',
'space-before-function-paren',
'space-infix-ops',
]
};
tfw.disable = ` // eslint-disable-line ${tfw.rules.join(', ')}`;
tfw.disableRe = new RegExp('(\\n' + escapeRE('/* FW LINE 59:b820c6d */') + '[^\\n]+?)(' + escapeRE(tfw.disable) + ')?(\\n)');
function decorate(source) {
const decorated = {};
if (!source.startsWith('{')) return decorated;
let m = source.match(re.undecorated);
if (!m) throw new Error('no header');
let [, header, code, testCasesPrefix, testCasesVar, testCases, testCasesPostfix] = m;
code = code.replace(tfw.disableRe, `$1${tfw.disable}$3`);
// decorate header
decorated.header = jsonParseWithErrorInfo(header, source);
decorated.source = headerPrefix
+ header // the JSON
+ ');/* eslint-enable */'
+ code; // the actual code
if (testCasesPrefix) {
decorated.testCases = jsonParseWithErrorInfo(testCases, source);
decorated.source += testCasesPrefix // the prefix
+ '/* eslint-disable */' // disable all the rules
+ testCasesVar
+ `/* eslint-enable ${metaDataRules} */` // enable JSON rules
+ testCases
+ testCasesPostfix;
}
return decorated;
}
function tryFormatJSON(raw) {
try {
return JSON.stringify(JSON.parse(raw), null, '\t');
}
catch (_err) {
return raw;
}
}
function strip(source) {
const m = source.match(re.decorated);
if (!m) throw new Error('not decorated');
let [, prefix, header, code, testCasesPrefix, testCasesVar, testCases] = m;
code = code.replace(tfw.disableRe, '$1$3');
return tryFormatJSON(header) + (prefix ? '\n\n' + prefix.replace(/^\s*/, '') : '') + code + (testCasesPrefix || '') + tryFormatJSON(testCasesVar || '') + (testCases || '');
}
function exec(cmd) {
return childProcess.execSync(cmd, { cwd: repo, encoding: 'utf8' });
}
class Cache {
constructor() {
this.decorated = {};
this.repo = path.resolve(repo);
for (const translator of fs.readdirSync(this.repo)) {
if (!translator.endsWith('.js')) continue;
this.decorated[path.basename(translator)] = decorate(fs.readFileSync(path.join(repo, translator), 'utf-8'));
}
const branch = exec('git rev-parse --abbrev-ref HEAD').trim();
const hasUpstream = exec('git remote -v').split('\n')
.map(line => line.trim())
.includes('upstream\thttps://github.com/zotero/translators.git');
// branch to compare lastUpdated against -- assume that if have upstream/master, you want to compare against that
const master = hasUpstream ? 'upstream/master' : 'origin/master';
this.lastUpdated = {};
if (branch !== master) {
// `git diff --name-status ${master}` will fetch the names of the files that have changed against `${master}`
for (const file of exec(`git diff --name-status ${master}`).split('\n')) {
const m = file.match(/^M\t([^/]+\.js)$/); // js files that are modified but don't have a / in their path to pick out files in the root
if (m && this.decorated[m[1]]) this.decorated[m[1]].modified = true;
}
/*
We do a `git grep '"lastUpdated"' ${master} *.js` to get the
`lastUpdated` values from the `${master}` branch. For files that are
deemed changed, the lastUpdated is remembered (so the presence of lastUpdated implies modified).
This info is used in the 'last-updated' rule.
*/
for (const lu of exec(`git grep '"lastUpdated"' ${master} *.js`).split('\n')) {
const m = lu.match(/^[a-z/]+:([^:]+):\s*"lastUpdated"\s*:\s*"([-0-9: ]+)"/);
if (!m) continue;
const translator = m[1];
if (this.decorated[translator] && this.decorated[translator].modified) this.decorated[translator].lastUpdated = m[2];
}
}
}
get(filename) {
const basename = path.basename(filename);
// don't load stuff outside the root dir
if (!this.decorated[basename] && path.dirname(path.resolve(filename)) !== this.repo) this.decorated[basename] = {};
return this.decorated[basename];
}
conflicts(filename, translatorID) {
filename = path.basename(filename);
for (const [otherFilename, otherHeader] of Object.entries(this.decorated)) {
if (otherFilename !== filename && otherHeader.translatorID === translatorID) {
return otherHeader.parsed;
}
}
return false;
}
}
function getHeaderFromAST(programNode) {
const declaration = programNode.body[0];
if (!declaration) return {};
if (declaration.type !== 'VariableDeclaration' || declaration.declarations.length !== 1 || declaration.declarations[0].id.name !== headerVar) return {};
const body = declaration.declarations[0].init;
if (!body || body.type !== 'ObjectExpression') return {};
const properties = {};
for (const property of body.properties) {
properties[property.key.value] = property.value;
}
return { declaration, body, properties, followingStatement: programNode.body[1] };
}
module.exports = {
decorate,
strip,
cache: new Cache(),
getHeaderFromAST,
};
if (require.main === module) {
const orig = fs.readFileSync(path.join(__dirname, '../../../Amazon.js'), 'utf-8');
const decorated = decorate(orig);
const stripped = strip(decorated.source);
console.log(stripped === orig); // eslint-disable-line no-console
}

View File

@ -0,0 +1,151 @@
{
"name": "eslint-plugin-zotero-translator",
"version": "0.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "eslint-plugin-zotero-translator",
"version": "0.0.1",
"license": "ISC",
"dependencies": {
"commander": "^2.19.0",
"find-root": "^1.1.0",
"recursive-readdir": "^2.2.3",
"require-dir": "^1.2.0",
"uuid": "^3.3.2"
},
"bin": {
"teslint": "bin/teslint.js"
},
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/find-root": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/recursive-readdir": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz",
"integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==",
"dependencies": {
"minimatch": "^3.0.5"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/require-dir": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/require-dir/-/require-dir-1.2.0.tgz",
"integrity": "sha512-LY85DTSu+heYgDqq/mK+7zFHWkttVNRXC9NKcKGyuGLdlsfbjEPrIEYdCVrx6hqnJb+xSu3Lzaoo8VnmOhhjNA==",
"engines": {
"node": "*"
}
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
}
},
"dependencies": {
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"find-root": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng=="
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"recursive-readdir": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz",
"integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==",
"requires": {
"minimatch": "^3.0.5"
}
},
"require-dir": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/require-dir/-/require-dir-1.2.0.tgz",
"integrity": "sha512-LY85DTSu+heYgDqq/mK+7zFHWkttVNRXC9NKcKGyuGLdlsfbjEPrIEYdCVrx6hqnJb+xSu3Lzaoo8VnmOhhjNA=="
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
}
}
}

View File

@ -5,7 +5,7 @@
"author": "Emiliano Heyns",
"main": "index.js",
"engines": {
"node": ">=0.10.0"
"node": ">=16.0.0"
},
"license": "ISC",
"bin": {
@ -14,7 +14,7 @@
"dependencies": {
"commander": "^2.19.0",
"find-root": "^1.1.0",
"recursive-readdir-synchronous": "0.0.4",
"recursive-readdir": "^2.2.3",
"require-dir": "^1.2.0",
"uuid": "^3.3.2"
}

View File

@ -0,0 +1,257 @@
'use strict';
const espree = require('espree');
const clarinet = require('clarinet');
const findRoot = require('find-root');
const path = require('path');
const fs = require('fs');
const childProcess = require('child_process');
let repo;
try {
repo = path.resolve(findRoot(__dirname, dir => fs.existsSync(path.join(dir, '.git'))));
}
catch (e) {
console.error('ERROR: Translators can only be linted inside a clone of the zotero/translators repo (not a ZIP downloaded from GitHub)');
console.error(' git clone https://github.com/zotero/translators.git');
process.exit(1); // eslint-disable-line no-process-exit
}
function exec(cmd) {
return childProcess.execSync(cmd, { cwd: repo, encoding: 'utf8' });
}
// have to pre-load everything to test for conflicting headers
const cache = new Map();
function updateCache(text, filename) {
if (text[0] !== '{') return;
if (cache.has(filename) && cache.get(filename).text === text) {
// No change - no need to re-parse
return;
}
// detect header
const prefix = `const ZoteroTranslator${Date.now()} = `;
const decorated = `${prefix}${text}`;
let ast;
try {
ast = espree.parse(decorated, { comment: true, loc: true, ecmaVersion: 2023 });
}
catch (err) {
console.log(filename, err.message);
process.exit(1); // eslint-disable-line no-process-exit
}
const header = ((ast.body[0] || {}).declarations[0] || {}).init;
const testcases = ast.body
.filter((node, i) => i === ast.body.length - 1)
.filter(node => node.type === 'VariableDeclaration' && node.declarations.length === 1).map(node => node.declarations[0])
.filter(node => node.type === 'VariableDeclarator' && node.id.type === 'Identifier' && node.id.name === 'testCases')
.map(node => node.init)[0];
const extract = (node) => {
if (!node) return {};
return {
start: node.loc.start.line,
end: node.loc.end.line,
text: decorated.substring(node.start, node.end),
};
};
const entry = {
text,
header: extract(header),
testcases: extract(testcases),
FW: ast.comments.find(comment => comment.type === 'Block' && comment.value.trim === 'FW LINE 59:b820c6d')
};
try {
entry.header.fields = JSON.parse(entry.header.text);
}
catch (err) {
// ignore
}
cache.set(filename, entry);
}
for (let filename of fs.readdirSync(repo).sort()) {
if (!filename.endsWith('.js')) continue;
filename = path.join(repo, filename);
const text = fs.readFileSync(filename, 'utf-8');
updateCache(text, filename);
}
for (const lu of exec(`git grep '"lastUpdated"' HEAD~1`).split('\n')) {
const m = lu.match(/^HEAD~1:([^:]+):\s*"lastUpdated"\s*:\s*"([-0-9: ]+)"/);
if (!m) continue;
const [, translator, lastUpdated] = m;
const filename = path.join(repo, translator);
if (cache.has(filename)) cache.get(filename).lastUpdated = lastUpdated;
}
function tryJSON(json, offset) {
const parser = clarinet.parser();
let error;
const message = e => ({
message: (e.message || '').split('\n', 1)[0],
line: parser.line + offset.line,
column: parser.column,
position: parser.position + offset.position,
});
// trigger the parse error
parser.onerror = function (e) {
error = message(e);
parser.close();
};
try {
parser.write(json).close();
}
catch (e) {
return error || message(e);
}
return error;
}
function JSONTokens(json, offset) {
const parser = clarinet.parser();
const tokens = [];
parser.onvalue = function (v) {
tokens.push({ type: 'value', value: v, line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.onopenobject = function (key) {
tokens.push({ type: 'object-open', key, line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.onkey = function (key) {
tokens.push({ type: 'key', key, line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.oncloseobject = function () {
tokens.push({ type: 'object-close', line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.onopenarray = function () {
tokens.push({ type: 'array-open', line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.onclosearray = function () {
tokens.push({ type: 'array-close', line: parser.line + offset.line, column: parser.column, position: parser.position + offset.position });
};
parser.write(json).close();
return tokens;
}
function header(program) {
if (!program) return null;
if (program.type !== 'Program') return null;
if (program.body.length === 0) return null;
if (program.body[0].type !== 'ExpressionStatement') return null;
if (program.body[0].expression.type !== 'ObjectExpression') return null;
return program.body[0].expression;
}
function conflict(filename) {
const translatorID = (((cache.get(filename) || {}).header || {}).fields || {}).translatorID;
if (!translatorID) return null;
for (const [other, header] of cache.entries()) {
if (other !== filename && header.translatorID === translatorID) {
return header.fields;
}
}
return null;
}
const junk = new RegExp(`${path.sep}0_`.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') + '.*');
module.exports = {
support: {
repo,
parsed: filename => cache.get(filename.replace(junk, '')),
header,
IDconflict: conflict,
json: {
try: tryJSON,
tokens: JSONTokens,
}
},
supportsAutofix: true,
preprocess: function (text, filename) {
// We might be running on an in-memory version of the translator newer
// than what we read from disk earlier, so update the cache
updateCache(text, filename);
const parsed = cache.get(filename);
if (text[0] !== '{' || !parsed) return [{ text, filename }];
if (parsed.header.text) {
return [{ text: `(${text.slice(0, parsed.header.text.length)});${text.slice(parsed.header.text.length)}`, filename }];
}
else {
return [{ text, filename }];
}
},
postprocess: function (messages, filename) {
messages = [].concat(...messages);
const parsed = cache.get(filename);
if (parsed) {
const header = parsed.header;
if (header.text) {
messages = messages.filter((m) => {
if (!m.ruleId) return true;
if (m.ruleId.startsWith('zotero-translator/header') && m.line > header.end) return false;
switch (m.ruleId) {
case 'no-unused-expressions':
return m.line !== 1;
case 'quote-props':
return m.line > header.end;
default:
}
return true;
});
const adjust = (p) => {
if (p > header.text.length) return p - 3; // remove '(' and ');'
if (p > 1) return p - 1; // remove '('
return p;
};
for (const m of messages) {
if (m.fix) m.fix.range = m.fix.range.map(adjust);
if (m.suggestions) {
for (const s of m.suggestions) {
if (s.fix) s.fix.range = s.fix.range.map(adjust);
}
}
}
}
const testcases = parsed.testcases;
if (testcases && testcases.text) {
messages = messages.filter((m) => {
if (!m.ruleId) return true;
if (m.ruleId.startsWith('zotero-translator/test-cases') && m.line < testcases.start) return false;
switch (m.ruleId) {
case 'semi':
case 'quote-props':
return m.line < testcases.start || m.line > testcases.end;
case 'lines-around-comment':
return m.line !== testcases.end + 1;
}
return true;
});
}
}
return messages;
},
};

33
.ci/helper.sh Normal file → Executable file
View File

@ -19,30 +19,11 @@ get_translator_id() {
}
get_translators_to_check() {
# If a PR branch has no conflicts with the master then git
# creates a custom merge commit where it merges PR into master.
# Travis-CI tests on that commit instead of the HEAD of the PR branch.
#
# Thus below we first determine if HEAD is a merge commit by checking how
# many parents the current HEAD has. If number of parents > 1, then it's a merge commit
# in which case we need to diff translator names between HEAD^2 and PR split commit from master.
# The above will generally only be the case in CI or if using a custom PR pulling script which
# pulls the merge PR commit instead of just the PR branch.
#
# If the HEAD commit is not a merge then we diff HEAD with PR split commit from master. This is the case
# when running from a local development PR branch
#
# The branching point hash retrieval logic is based on https://stackoverflow.com/a/12185115/3199106
TRANSLATORS_TO_CHECK=""
# Gets parent commits. Either one or two hashes
local parent_commits=($(git show --no-patch --format="%P" HEAD))
# Size of $parent_commits array
local num_parent_commits=${#parent_commits[@]}
if [ $num_parent_commits -gt 1 ]; then
TRANSLATORS_TO_CHECK=$(git diff HEAD^2 $(git rev-list "$(git rev-list --first-parent ^origin/master HEAD^2 | tail -n1)^^!") --name-only | grep -e "^[^/]*.js$")
else
TRANSLATORS_TO_CHECK=$(git diff $(git rev-list "$(git rev-list --first-parent ^origin/master HEAD | tail -n1)^^!") --name-only | grep -e "^[^/]*.js$")
fi
# Get the last commit on the target branch before this branch diverged
# Fall back to translators changed on the last commit in case there's no GITHUB_BASE_REF
# and no upstream/master (CI runs on push)
local fork_point=$(git merge-base --fork-point ${GITHUB_BASE_REF:-upstream/master} HEAD 2>/dev/null || echo HEAD~)
# Get translator scripts changed between that commit and now, excluding deleted files
local all_translator_scripts="$(git rev-parse --show-toplevel)"/*.js
git diff --name-only --diff-filter=d $fork_point -- $all_translator_scripts
}

View File

@ -5,5 +5,8 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$dir/helper.sh"
get_translators_to_check
npm run lint -- "$TRANSLATORS_TO_CHECK"
translators_to_check=$(get_translators_to_check)
if [ -n "$translators_to_check" ]; then
# No `xargs -d` support in macOS, so workaround with `tr`
echo "$translators_to_check" | tr '\n' '\0' | xargs -0 npm run lint --
fi

View File

@ -0,0 +1,164 @@
import chalk from 'chalk';
import path from 'path';
import process from 'process';
import { chromium } from 'playwright';
import * as translatorServer from './translator-server.mjs';
const chromeExtensionDir = path.join(import.meta.dirname, 'connectors', 'build', 'manifestv3');
const KEEP_BROWSER_OPEN = 'KEEP_BROWSER_OPEN' in process.env;
const CI = 'CI' in process.env;
const ZOTERO_CONNECTOR_EXTENSION_ID = 'ekhagklcjbdpajgpjgmbionohlpdbjgc';
async function getTranslatorsToTest() {
const translatorFilenames = process.argv[2].split('\n').filter(filename => filename.trim().length > 0);
let changedTranslatorIDs = [];
let toTestTranslatorIDs = new Set();
let toTestTranslatorNames = new Set();
for (const translatorFilename of translatorFilenames) {
let translator = translatorServer.filenameToTranslator[translatorFilename];
if (!translator) {
console.error(chalk.yellow(`Translator '${translatorFilename}' not found`));
continue;
}
else if (translator.metadata === null) {
console.error(chalk.red(`
Translator '${translatorFilename}' is not correctly formatted.
Please use Scaffold (Tools Translator Editor) to create translators, and test
that your translator works before opening a PR.
AI tools may help with drafting code to add to your translator, but you should
never use an AI tool to generate its overall structure without using Scaffold
first. LLMs have very little Zotero translator code in their training sets and
generally fail to generate translator code with a valid layout (or even a real
UUID).
`.trim()));
continue;
}
let metadata = translator.metadata;
changedTranslatorIDs.push(metadata.translatorID);
toTestTranslatorIDs.add(metadata.translatorID);
toTestTranslatorNames.add(metadata.label);
}
// Find all translators that use the changed translators and add them to list/check them too
let changedTranslatorIDRe = new RegExp(changedTranslatorIDs.join('|'));
let tooManyTranslators = false;
for (let translator of translatorServer.translators) {
if (!changedTranslatorIDRe.test(translator.content)) continue;
toTestTranslatorIDs.add(translator.metadata.translatorID);
toTestTranslatorNames.add(translator.metadata.label);
if (toTestTranslatorIDs.size >= 10) {
tooManyTranslators = true;
break;
}
}
if (tooManyTranslators) {
console.log(
`Over 10 translators need to be tested, but this will take too long
and timeout the CI environment. Truncating to 10.
This is likely to happen when changing Embedded Metadata which is
loaded by pretty much every other translator or when a PR contains
a lot of changed translators.
You may want to consider adding '[ci skip]' in the commit message.`
)
}
console.log(`Will run tests for translators ${JSON.stringify(Array.from(toTestTranslatorNames))}`);
return Array.from(toTestTranslatorIDs);
}
function report(results) {
var allPassed = true;
for (let translatorID in results) {
let translatorResults = results[translatorID];
console.log(chalk.bold(chalk.bgWhite(chalk.black(`Running tests for ${translatorID}: ${translatorResults.label}`))));
let padding = 2;
let output = translatorResults.message.split("\n");
for (let line of output) {
if (/^Running \d+ tests? for/.test(line)) {
console.log(" ".repeat(padding - 1) + chalk.bgCyan(chalk.black(line)));
}
else if (line.match(/^-/)) {
console.log(chalk.red("-" + " ".repeat(padding) + line.substr(1)));
}
else if (line.match(/^\+/)) {
console.log(chalk.green("+" + " ".repeat(padding) + line.substr(1)));
}
else if (line.match(/^Test \d+: succeeded/)) {
console.log(" ".repeat(padding) + chalk.bgGreen(line));
}
else if (line.match(/^Test \d+: failed/)) {
console.log(" ".repeat(padding) + chalk.bgRed(line));
allPassed = false;
}
else {
console.log(" ".repeat(padding) + line);
}
}
console.log("\n");
}
return allPassed
}
var allPassed = false;
let context;
try {
await translatorServer.serve();
context = await chromium.launchPersistentContext('/tmp/chromium-user-data-dir', {
channel: 'chromium',
headless: CI,
args: [
`--disable-extensions-except=${chromeExtensionDir}`,
`--load-extension=${chromeExtensionDir}`
]
});
console.log(`Browser version: ${context.browser().version()}`);
const translatorsToTest = await getTranslatorsToTest();
await new Promise(resolve => setTimeout(resolve, 500));
let testUrl = `chrome-extension://${ZOTERO_CONNECTOR_EXTENSION_ID}/tools/testTranslators/testTranslators.html#translators=${translatorsToTest.join(',')}`;
let page = await context.newPage();
await page.goto(testUrl);
for (let i = 0; i <= 3; i++) {
let title = (await page.title()).trim();
if (title === 'Zotero Translator Tester') {
break;
}
if (i === 3) {
console.error('Failed to load Translator Tester extension page');
process.exit(2);
}
await new Promise(resolve => setTimeout(resolve, 100));
}
await page.locator('#translator-tests-complete')
.waitFor({
state: 'attached',
timeout: 5 * 60 * 1000,
});
let testResults = await page.evaluate(() => window.seleniumOutput);
allPassed = report(testResults);
}
catch (e) {
console.error(e);
}
finally {
if (!KEEP_BROWSER_OPEN) {
await context.close();
}
translatorServer.stopServing();
if (allPassed) {
console.log(chalk.green("All translator tests passed"));
} else {
console.log(chalk.red("Some translator tests failed"));
}
process.exit(allPassed ? 0 : 1);
}

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
echo "::group::Setup"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="$( dirname "$DIR" )"
@ -10,6 +12,8 @@ mkdir -p connectors
cd connectors
if [ -d .git ]; then
# Temp fix for connectors/src/zotero/resource/schema/global submodule fetch failing
git config url."https://".insteadOf git://
git pull
git submodule update
git -C src/zotero/ submodule update -- resource/schema/global
@ -17,6 +21,7 @@ if [ -d .git ]; then
npm ci
else
git clone https://github.com/zotero/zotero-connectors.git --depth 1 .
git config url."https://".insteadOf git://
git submodule update --init --depth 1
git -C src/zotero submodule update --init --depth 1 -- resource/schema/global
git -C src/zotero submodule update --init --depth 1 -- resource/SingleFile
@ -24,11 +29,11 @@ else
fi
export ZOTERO_REPOSITORY_URL="http://localhost:8085/"
export CHROME_EXTENSION_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDllBS5q+Z9T9tPgYwRN+/8T9wzyjo9tRo03Wy8zP2DQ5Iy+3q0Tjq2vKXGiMCxC/ZVuEMC68Ekv+jNT43VxPbEXI4dzpK1GMBqPJpAcEOB8B1ROBouQMbGGTG7fOdQVlmpdTTPVndVwysJ02CrDMn96IG2ytOq2PO7GR2xleCudQIDAQAB"
./build.sh -p b -d
cd ..
npm explore chromedriver -- npm run install --detect_chromedriver_version
echo "::endgroup::"
get_translators_to_check
./selenium-test.js "$TRANSLATORS_TO_CHECK"
node browser-test.mjs "$(get_translators_to_check)"

View File

@ -1,147 +0,0 @@
#!/usr/bin/env node
const path = require('path');
const process = require('process');
const selenium = require('selenium-webdriver');
const until = require('selenium-webdriver/lib/until');
const chalk = require('chalk');
const translatorServer = require('./translator-server');
const chromeExtensionDir = path.join(__dirname, 'connectors', 'build', 'chrome');
const KEEP_BROWSER_OPEN = 'KEEP_BROWSER_OPEN' in process.env;
async function getTranslatorsToTest() {
const translatorFilenames = process.argv[2].split('\n').filter(filename => filename.trim().length > 0);
let changedTranslatorIDs = [];
let toTestTranslatorIDs = new Set();
let toTestTranslatorNames = new Set();
for (const translatorFilename of translatorFilenames) {
let translatorInfo = translatorServer.filenameToTranslator[translatorFilename].metadata;
changedTranslatorIDs.push(translatorInfo.translatorID);
toTestTranslatorIDs.add(translatorInfo.translatorID);
toTestTranslatorNames.add(translatorInfo.label);
}
// Find all translators that use the changed translators and add them to list/check them too
let tooManyTranslators = false;
for (let translator of translatorServer.translators) {
for (let translatorID of changedTranslatorIDs) {
if (!translator.content.includes(translatorID)) continue;
toTestTranslatorIDs.add(translator.metadata.translatorID);
toTestTranslatorNames.add(translator.metadata.label);
if (toTestTranslatorIDs.size >= 10) {
tooManyTranslators = true;
break;
}
}
if (tooManyTranslators) break;
}
if (tooManyTranslators) {
console.log(
`Over 10 translators need to be tested, but this will take too long
and timeout the CI environment. Truncating to 10.
This is likely to happen when changing Embedded Metadata which is
loaded by pretty much every other translator or when a PR contains
a lot of changed translators.
You may want to consider adding '[ci skip]' in the commit message.`
)
}
console.log(`Will run tests for translators ${JSON.stringify(Array.from(toTestTranslatorNames))}`);
return Array.from(toTestTranslatorIDs);
}
function report(results) {
var allPassed = true;
for (let translatorID in results) {
let translatorResults = results[translatorID];
console.log(chalk.bold(chalk.bgWhite(chalk.black(`Beginning Tests for ${translatorID}: ${translatorResults.label}`))));
let padding = 2;
let output = translatorResults.message.split("\n");
for (let line of output) {
if (line.match(/^TranslatorTester: Running [^T]*Test [0-9]*$/) ||
line.match(/^TranslatorTester: Running [0-9]* tests for .*$/)) {
console.log(" ".repeat(padding-1) + chalk.bgCyan(chalk.black(line)));
}
else if (line.match(/^-/)) {
console.log(chalk.red("-" + " ".repeat(padding) + line.substr(1)));
}
else if (line.match(/^\+/)) {
console.log(chalk.green("+" + " ".repeat(padding) + line.substr(1)));
}
else if (line.match(/^TranslatorTester: [^T]*Test [0-9]*: succeeded/)) {
console.log(" ".repeat(padding) + chalk.bgGreen(line));
}
else if (line.match(/^TranslatorTester: [^T]*Test [0-9]*: unknown/)) {
console.log(" ".repeat(padding) + chalk.bgYellow(chalk.black(line)));
allPassed = false;
}
else if (line.match(/^TranslatorTester: [^T]*Test [0-9]*: failed/)) {
console.log(" ".repeat(padding) + chalk.bgRed(line));
allPassed = false;
}
else {
console.log(" ".repeat(padding) + line);
}
}
console.log("\n");
}
return allPassed
}
var allPassed = false;
(async function() {
let driver;
try {
translatorServer.serve();
require('chromedriver');
let chrome = require('selenium-webdriver/chrome');
let options = new chrome.Options();
options.addArguments(`load-extension=${chromeExtensionDir}`);
if ('BROWSER_EXECUTABLE' in process.env) {
options.setChromeBinaryPath(process.env['BROWSER_EXECUTABLE']);
}
driver = new selenium.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
// No API to retrieve extension ID. Hacks, sigh.
await driver.get("chrome://system/");
await driver.wait(until.elementLocated({id: 'extensions-value-btn'}), 60*1000);
let extBtn = await driver.findElement({css: '#extensions-value-btn'});
await extBtn.click();
let contentElem = await driver.findElement({css: '#content'});
let text = await contentElem.getText();
let extId = text.match(/([^\s]*) : Zotero Connector/)[1];
// We got the extension ID and test URL, let's test
const translatorsToTest = await getTranslatorsToTest();
let testUrl = `chrome-extension://${extId}/tools/testTranslators/testTranslators.html#translators=${translatorsToTest.join(',')}`;
await new Promise((resolve) => setTimeout(() => resolve(driver.get(testUrl)), 500));
await driver.wait(until.elementLocated({id: 'translator-tests-complete'}), 30*60*1000);
testResults = await driver.executeScript('return window.seleniumOutput');
allPassed = report(testResults);
}
catch (e) {
console.error(e);
}
finally {
if (!KEEP_BROWSER_OPEN) {
await driver.quit();
}
translatorServer.stopServing();
if (allPassed) {
console.log(chalk.green("All translator tests passed"));
} else {
console.log(chalk.red("Some translator tests failed"));
}
process.exit(allPassed ? 0 : 1);
}
})();

View File

@ -1,6 +1,6 @@
const http = require("http");
const fs = require('fs').promises;
const path = require('path');
import http from 'http';
import { promises as fs } from 'fs';
import path from 'path';
const host = 'localhost';
const port = 8085;
@ -9,7 +9,7 @@ var server;
var translators = [];
var idToTranslator = {};
var filenameToTranslator = {};
const rootPath = path.join(__dirname, '../..');
const rootPath = path.join(import.meta.dirname, '../..');
const infoRe = /^\s*{[\S\s]*?}\s*?[\r\n]/;
async function loadTranslators() {
@ -19,11 +19,17 @@ async function loadTranslators() {
const fullPath = path.join(rootPath, file);
if (!fullPath.endsWith('.js') || !(await fs.stat(fullPath)).isFile()) continue;
let content = await fs.readFile(fullPath);
let translatorInfo = JSON.parse(infoRe.exec(content)[0]);
let translator = { metadata: translatorInfo, content };
let translator;
try {
let translatorInfo = JSON.parse(infoRe.exec(content)[0]);
translator = { metadata: translatorInfo, content };
idToTranslator[translatorInfo.translatorID] = translator;
}
catch (e) {
translator = { metadata: null, content };
}
translators.push(translator);
filenameToTranslator[file] = translator;
idToTranslator[translatorInfo.translatorID] = translator;
}
}
}
@ -56,17 +62,16 @@ async function requestListener(req, res) {
res.end();
}
module.exports = {
serve: async function() {
await loadTranslators();
server = http.createServer(requestListener);
server.listen(port, host, () => {
console.log(`Translator server is running on http://${host}:${port}`);
});
},
stopServing: function() {
server.close();
},
filenameToTranslator,
translators
};
async function serve() {
await loadTranslators();
server = http.createServer(requestListener);
server.listen(port, host, () => {
console.log(`Translator server is running on http://${host}:${port}`);
});
}
function stopServing() {
server.close();
}
export { serve, stopServing, filenameToTranslator, translators };

View File

@ -1,2 +0,0 @@
#!/bin/sh
/usr/bin/xvfb-run /usr/bin/google-chrome $@

75
.ci/updateTypes.mjs Executable file
View File

@ -0,0 +1,75 @@
#!/usr/bin/env node
import { readFile, writeFile } from 'fs/promises';
const INDEX_D_TS_URL = new URL('../index.d.ts', import.meta.url);
const SCHEMA_JSON_URL = new URL('../../zotero-client/resource/schema/global/schema.json', import.meta.url);
const BEGIN_MARKER = '\t/* *** BEGIN GENERATED TYPES *** */';
const END_MARKER = '\t/* *** END GENERATED TYPES *** */';
async function updateIndexDTS() {
let indexDTS = await readFile(INDEX_D_TS_URL, { encoding: 'utf8' });
let schema = JSON.parse(await readFile(SCHEMA_JSON_URL));
let typeItemTypes = '\ttype ItemTypes = {';
let itemTypeTypes = '';
let creatorTypes = new Set();
for (let typeSchema of schema.itemTypes) {
let itemType = typeSchema.itemType;
if (['annotation', 'attachment', 'note'].includes(itemType)) {
continue;
}
let itemTypeUppercase = itemType[0].toUpperCase() + itemType.substring(1) + 'Item';
if (itemTypeUppercase == 'TvBroadcastItem') {
itemTypeUppercase = 'TVBroadcastItem';
}
typeItemTypes += `\n\t\t"${itemType}": ${itemTypeUppercase},`;
itemTypeTypes += `\n\n\ttype ${itemTypeUppercase} = {`;
itemTypeTypes += `\n\t\titemType: "${itemType}";`;
for (let { field } of typeSchema.fields) {
itemTypeTypes += `\n\t\t${field}?: string;`
}
let creatorTypesJoined = typeSchema.creatorTypes.map(typeSchema => '"' + typeSchema.creatorType + '"').join(' | ');
itemTypeTypes += `\n\n\t\tcreators: Creator<${creatorTypesJoined}>[];`;
itemTypeTypes += '\n\t\tattachments: Attachment[];';
itemTypeTypes += '\n\t\ttags: Tag[];';
itemTypeTypes += '\n\t\tnotes: Note[];';
itemTypeTypes += '\n\t\tseeAlso: string[];';
itemTypeTypes += '\n\t\tcomplete(): void;';
itemTypeTypes += '\n\n\t\t[key: string]: string;';
itemTypeTypes += '\n\t};';
for (let { creatorType } of typeSchema.creatorTypes) {
creatorTypes.add(creatorType);
}
}
typeItemTypes += '\n\t};'
let typeCreatorType = '\n\ttype CreatorType =';
for (let creatorType of Array.from(creatorTypes).sort()) {
typeCreatorType += `\n\t\t| "${creatorType}"`;
}
typeCreatorType += ';';
let beginIdx = indexDTS.indexOf(BEGIN_MARKER);
let endIdx = indexDTS.indexOf(END_MARKER);
if (beginIdx == -1 || endIdx == -1) {
throw new Error('Could not find generated types section in index.d.ts');
}
indexDTS = indexDTS.substring(0, beginIdx) + BEGIN_MARKER + '\n'
+ typeItemTypes
+ itemTypeTypes
+ '\n' + typeCreatorType
+ '\n'
+ indexDTS.substring(endIdx);
await writeFile(INDEX_D_TS_URL, indexDTS);
}
updateIndexDTS();

View File

@ -1,44 +1,60 @@
{
"env": {
"browser": false,
"es6": true
"browser": true,
"es2021": true
},
"extends": [
"@zotero"
],
"parserOptions": {
"ecmaVersion": 2017
"ecmaVersion": "2023"
},
"globals": {
"Zotero": "readonly",
"Z": "readonly",
"ZU": "readonly",
"DOMParser": "readonly",
"XPathResult": "readonly",
"XMLSerializer": "readonly",
"atob": "readonly"
"attr": "readonly",
"innerText": "readonly",
"text": "readonly",
"request": "readonly",
"requestText": "readonly",
"requestJSON": "readonly",
"requestDocument": "readonly"
},
"rules": {
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^detectWeb$|^doWeb$|^detectImport$|^doImport$|^doExport$|^detectSearch$|^doSearch$|^exports$"
"varsIgnorePattern": "^testCases$|^detectWeb$|^doWeb$|^detectImport$|^doImport$|^doExport$|^detectSearch$|^doSearch$|^exports$"
}
],
"no-redeclare": ["error", {"builtinGlobals": true}],
"linebreak-style": ["error", "unix"],
"lines-around-comment": [
"error",
{
"ignorePattern": "END TEST CASES"
}
],
"no-restricted-globals": ["error", {
"name": "document",
"message": "Use doc instead."
}],
"zotero-translator/not-executable": "error",
"zotero-translator/header-valid-json": "error",
"zotero-translator/translator-id": "error",
"zotero-translator/last-updated": "warn",
"zotero-translator/translator-type": "warn",
"zotero-translator/header-translator-id": "error",
"zotero-translator/header-last-updated": "warn",
"zotero-translator/header-translator-type": "warn",
"zotero-translator/no-for-each": "warn",
"zotero-translator/prefer-index-of": "warn",
"zotero-translator/robust-query-selector": "warn",
"zotero-translator/test-cases-valid-json": "error",
"zotero-translator/test-cases": "error",
"zotero-translator/translator-framework": "warn",
@ -49,5 +65,6 @@
},
"plugins": [
"zotero-translator"
]
],
"processor": "zotero-translator/translator"
}

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "All other translator issues and requests: Post to the Zotero Forums"
url: https://forums.zotero.org/post/discussion
about: Please do not use GitHub Issues to report problems saving webpages or to request a new translator. Post to the Zotero Forums. Zotero developers will create issues as necessary in the relevant repositories.

16
.github/ISSUE_TEMPLATE/template.md vendored Normal file
View File

@ -0,0 +1,16 @@
---
name: Report a confirmed bug with technical details
about: If youre sure youve identified a bug in a specific Zotero translator and can provide technical details, you can open an issue here.
---
**READ THIS BEFORE CREATING AN ISSUE**
Zotero generally does not use GitHub Issues for bug reports or feature requests in Zotero software.
If youre sure youve identified a bug in a specific Zotero translator, youre welcome to create an issue here.
Otherwise, please post all requests to the Zotero Forums at https://forums.zotero.org, where Zotero developers and many others can help. For confirmed bugs or agreed-upon changes, Zotero developers will create new issues in the relevant repositories.
Development questions involving code, APIs, or other technical topics can be posted to the zotero-dev mailing list at http://groups.google.com/group/zotero-dev.
See https://www.zotero.org/support/zotero_support for more information on how Zotero support works.

View File

@ -6,24 +6,21 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
# We're in a shallow single-branch clone, so get the origin/master HEAD and more history
- run: git fetch origin master --depth=1
- run: git fetch --depth=25
# We're in a shallow single-branch clone, so get the origin/master HEAD if not already on master
# and get more history on the current branch so we can find the branch point
- run: git fetch origin master:master --depth=1
if: github.ref != 'refs/heads/master'
- run: git fetch --update-shallow --depth=100 origin $(git rev-list HEAD)
- name: Install Node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: 14
# Local via act
- name: Install packages for act
if: env.ACT == 'true'
run: apt update && apt install -y xvfb git
node-version: 22
- name: Get current connector hash
id: get-connector-hash
run: |
@ -32,28 +29,28 @@ jobs:
- name: Cache connector code
id: connector-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: .ci/pull-request-check/connectors
key: connectors-${{ hashFiles('.ci/pull-request-check/check-pull-request.sh') }}-${{ steps.get-connector-hash.outputs.hash }}
- name: Install node packages
run: npm ci
#- name: Debugging with tmate
# uses: mxschmitt/action-tmate@v3.1
- name: Lint
run: ./lint.sh
working-directory: .ci
- name: Install Chromium
run: npx playwright install chromium
- name: Test pull request
if: github.event_name == 'pull_request'
run: ./check-pull-request.sh
working-directory: .ci/pull-request-check
- name: Check deleted.txt
run: ./checkDeletedTxt.sh
working-directory: .ci
if: ${{ success() || failure() }}
- name: Test pull request
if: github.event_name == 'pull_request'
env:
BROWSER_EXECUTABLE: /home/runner/work/translators/translators/.ci/pull-request-check/xvfb-run-chrome
run: ./check-pull-request.sh
working-directory: .ci/pull-request-check
- name: Lint
run: ./lint.sh
working-directory: .ci
if: ${{ success() || failure() }}

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
.ci/pull-request-check/connectors
.DS_Store

View File

@ -1,206 +0,0 @@
{
"translatorID": "bbf1617b-d836-4665-9aae-45f223264460",
"label": "A Contra Corriente",
"creator": "Sebastian Karcher",
"target": "^https?://acontracorriente\\.chass\\.ncsu\\.edu/index\\.php/acontracorriente/",
"minVersion": "2.1",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-08-18 20:51:04"
}
/*
A Contra Corriente Translator
Copyright (C) 2012 Sebastian Karcher and Avram Lyon
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affer General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affer General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function detectWeb(doc, url) {
if (url.indexOf('/article/view/')>-1) {
return "journalArticle";
} else if (getSearchResults(doc, url, true)) {
return "multiple";
}
}
function getSearchResults(doc, url, checkOnly) {
var items = {};
var found = false;
if (url.indexOf('/issue/view/')>-1) {
var rows = ZU.xpath(doc, '//*[@class="tocTitle"]/a');
} else {
var rows = ZU.xpath(doc, '//div[@id="results"]//tr');
}
for (var i=0; i<rows.length; i++) {
if (url.indexOf('/issue/view/')>-1) {
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
} else {
var href = ZU.xpathText(rows[i], './/td/a[contains(@class, "file")][1]/@href');
var title = ZU.xpathText(rows[i], './td[2]');
}
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, url, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
});
} else {
scrape(doc, url);
}
}
function scrape(doc, url) {
urlBibtex = url.replace('/article/view/', '/rt/captureCite/');
if (!/\/article\/view\/.+\/.+/.test(url)) {
urlBibtex += '/0';
}
urlBibtex += '/BibtexCitationPlugin';
//Z.debug(urlBibtex);
ZU.doGet(urlBibtex, function(text) {
var parser = new DOMParser();
var xml = parser.parseFromString(text, "text/html");
var bibtex = ZU.xpathText(xml, '//pre');
if (bibtex) {
var translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
item.attachments.push({
title: "Snapshot",
document: doc
});
item.complete();
});
translator.translate();
}
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://acontracorriente.chass.ncsu.edu/index.php/acontracorriente/article/view/102",
"items": [
{
"itemType": "journalArticle",
"title": "Carlos Iván Degregori: antropólogo del alma",
"creators": [
{
"firstName": "José",
"lastName": "Rénique",
"creatorType": "author"
}
],
"date": "2011",
"ISSN": "1548-7083",
"abstractNote": "Remembranza de la reciente muerte (18 de Mayo de 2011) en Lima de Carlos Iván Degregori, uno de los intelectuales peruanos más importantes de las últimas décadas y uno de los estudiosos internacionales más destacados de la violencia política. A Contracorriente se suma a los innumerables homenajes que se tributan a su memoria. Su colega y amigo a lo largo de muchos años, el historiador José Luis Rénique, traza en esta nota el perfil humano, intelectual y político de Degregori. Al final incluimos también una lista de sus principales publicaciones.",
"issue": "3",
"itemID": "AC102",
"libraryCatalog": "A Contra Corriente",
"publicationTitle": "A Contracorriente",
"shortTitle": "Carlos Iván Degregori",
"url": "http://acontracorriente.chass.ncsu.edu/index.php/acontracorriente/article/view/102",
"volume": "8",
"attachments": [
{
"title": "Snapshot"
}
],
"tags": [
"Carlos Iván degregori",
"Perú",
"historia"
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://tools.chass.ncsu.edu/open_journal/index.php/acontracorriente/issue/view/16/showToc",
"items": "multiple"
},
{
"type": "web",
"url": "http://acontracorriente.chass.ncsu.edu/index.php/acontracorriente/search/search?query=argentina&authors=&title=&abstract=&galleyFullText=&suppFiles=&dateFromMonth=&dateFromDay=&dateFromYear=&dateToMonth=&dateToDay=&dateToYear=&dateToHour=23&dateToMinute=59&dateToSecond=59&discipline=&subject=&type=&coverage=&indexTerms=",
"items": "multiple"
},
{
"type": "web",
"url": "http://acontracorriente.chass.ncsu.edu/index.php/acontracorriente/article/view/174",
"items": [
{
"itemType": "journalArticle",
"title": "\"La Huelga de los Conventillos\", Buenos Aires, Nueva Pompeya, 1936. Un aporte a los estudios sobre género y clase",
"creators": [
{
"firstName": "Verónica",
"lastName": "Norando",
"creatorType": "author"
},
{
"firstName": "Ludmila",
"lastName": "Scheinkman",
"creatorType": "author"
}
],
"date": "2011",
"ISSN": "1548-7083",
"abstractNote": "Este trabajo se propone realizar un análisis de las relaciones de género y clase a través de un estudio de caso: la “Huelga de los Conventillos” de la fábrica textil Gratry en 1936, que se extendió por más de tres meses, pasando casi inadvertida, sin embargo, para la investigación histórica. Siendo la textil una rama de industria con una mayoría de mano de obra femenina, el caso de la casa Gratry, donde el 60% de los 800 obreros eran mujeres, aparece como ejemplar para la observación de la actividad de las mujeres en conflicto. En el trabajo se analiza el rol de las trabajadoras en la huelga, su participación política, sus formas de organización y resistencia, haciendo eje en las determinaciones de género y de clase que son abordadas de manera complementaria e interrelacionada, así como el complejo entramado de tensiones y solidaridades que éstas generan. De éste modo, se pretende ahondar en la compleja conformación de una identidad obrera femenina, a la vez que se discute con aquella mirada historiográfica tradicional que ha restado importancia a la participación de la mujer en el conflicto social. Esto se realizará a través de la exploración de una serie de variables: las relaciones inter-género e inter-clase (fundamentalmente el vínculo entre las trabajadoras y la patronal masculina), inter-género e intra-clase (la relación entre trabajadoras y trabajadores), intra-género e inter-clase (los lazos entre las trabajadoras y las vecinas comerciantes del barrio), intra-género e intra-clase (relaciones de solidaridad entre trabajadoras en huelga, y de antagonismo entre huelguistas y “carneras”). Para ello se trabajó un corpus documental que incluye información de tipo cuantitativa (las estadísticas del Boletín Informativo del Departamento Nacional del Trabajo), y cualitativa: periódicos obreros fundamentalmente El Obrero Textil, órgano gremial de la Unión Obrera Textil, Semanario de la CGT-Independencia (órgano de la Confederación General del Trabajo (CGT)-Independencia) y La Vanguardia (periódico del Partido Socialista), entre otros, y entrevistas orales a vecinas de Nueva Pompeya y familiares de trabajadoras de la fábrica Gratry. Se desarrollará una metodología cuali-cuantitativa para el cruce de estas fuentes.",
"issue": "1",
"itemID": "AC174",
"libraryCatalog": "A Contra Corriente",
"pages": "137",
"publicationTitle": "A Contracorriente",
"url": "http://acontracorriente.chass.ncsu.edu/index.php/acontracorriente/article/view/174",
"volume": "9",
"attachments": [
{
"title": "Snapshot"
}
],
"tags": [
"huelga",
"relaciones de género",
"trabajadores",
"trabajadroras"
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

224
ABC News Australia.js Normal file
View File

@ -0,0 +1,224 @@
{
"translatorID": "92d45016-5f7b-4bcf-bb63-193033f02f2b",
"label": "ABC News Australia",
"creator": "Joyce Chia",
"target": "https?://(www\\.)?abc\\.net\\.au/news/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-07-23 00:29:10"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2020-2021 Joyce Chia
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
let contentType = attr(doc, 'meta[property="ABC.ContentType"]', 'content');
if (contentType == 'CMChannel' && getSearchResults(doc, true)) {
return 'multiple';
}
else if (contentType == 'Video') {
return 'videoRecording';
}
else if (contentType == 'Article') {
return 'newspaperArticle';
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h3 a');
for (var i = 0; i < rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) return;
ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
item.language = "en-AU";
// og:url does not preserve https prefixes, so use canonical link until fixed
var canonical = doc.querySelector('link[rel="canonical"]');
if (canonical) {
item.url = canonical.href;
}
if (item.itemType == 'videoRecording') {
item.studio = "ABC News"; // i guess this is correct...
}
else {
item.publicationTitle = "ABC News";
}
item.language = "en-AU";
if (item.date) {
item.date = ZU.strToISO(item.date);
}
else {
item.date = ZU.strToISO(attr(doc, 'time', 'datetime'));
}
var authors = text(doc, '[data-component="Byline"] p');
if (authors && item.creators.length <= 1) {
authors = authors.replace(/^By /, '');
if (authors == authors.toUpperCase()) { // convert to title case if all caps
authors = ZU.capitalizeTitle(authors, true);
}
item.creators = [];
var authorsList = authors.split(/,|\band\b/);
for (let i = 0; i < authorsList.length; i++) {
item.creators.push(ZU.cleanAuthor(authorsList[i], "author"));
}
}
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = detectWeb(doc, url);
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.abc.net.au/news/2020-05-22/nt-government-coronavirus-recovery-commission-michael-gunner/12276832?section=politics",
"items": [
{
"itemType": "newspaperArticle",
"title": "NT 'uniquely positioned' to solve Australia's economic woes post-COVID-19, says Chief Minister",
"creators": [
{
"firstName": "Lauren",
"lastName": "Roberts",
"creatorType": "author"
}
],
"date": "2020-05-22",
"abstractNote": "The NT Labor Government establishes a new commission to help it financially recover from the coronavirus pandemic, with the former opposition leader and a former chief minister in key roles.",
"language": "en-AU",
"libraryCatalog": "www.abc.net.au",
"publicationTitle": "ABC News",
"url": "https://www.abc.net.au/news/2020-05-22/nt-government-coronavirus-recovery-commission-michael-gunner/12276832",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "chief minister michael gunner"
},
{
"tag": "coronavirus budget"
},
{
"tag": "nt budget"
},
{
"tag": "parliament house"
},
{
"tag": "territory economic reconstruction commission"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.abc.net.au/news/2021-07-23/tracey-holmes-on-the-ground-in-tokyo/13467310",
"items": [
{
"itemType": "videoRecording",
"title": "Tracey Holmes on the ground in Tokyo",
"creators": [
{
"firstName": "Tracey",
"lastName": "Holmes",
"creatorType": "author"
}
],
"date": "2021-07-22",
"abstractNote": "Brisbane is named the host of the 2032 Olympics, Tracey speaks with Federal Sports Minister Richard Colbeck to get his reaction. Plus we look at the COVID safety measures athletes, officials and the media are subjected to as they land in the Japanese capital.",
"language": "en-AU",
"libraryCatalog": "www.abc.net.au",
"studio": "ABC News",
"url": "https://www.abc.net.au/news/2021-07-23/tracey-holmes-on-the-ground-in-tokyo/13467310",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "olympics"
},
{
"tag": "tokyo olympics 2021"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

165
ACLS Humanities EBook.js Normal file
View File

@ -0,0 +1,165 @@
{
"translatorID": "2553b683-dc1b-4a1e-833a-7a7755326186",
"label": "ACLS Humanities EBook",
"creator": "Abe Jellinek",
"target": "^https?://www\\.fulcrum\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-03 01:54:15"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('meta[name="citation_title"]')) {
return "book";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.document a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(text(row, 'h3'));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
item.libraryCatalog = 'ACLS Humanities EBook';
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.fulcrum.org/concern/monographs/79408038k?locale=en",
"items": [
{
"itemType": "book",
"title": "Empire, Architecture, and the City: French-Ottoman Encounters, 1830-1914",
"creators": [
{
"firstName": "Zeynep",
"lastName": "Celik",
"creatorType": "author"
}
],
"date": "2008",
"ISBN": "9780295987798",
"language": "en",
"libraryCatalog": "ACLS Humanities EBook",
"publisher": "U of Washington Press",
"shortTitle": "Empire, Architecture, and the City",
"url": "https://hdl.handle.net/2027/heb.33994",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.fulcrum.org/concern/monographs/9z9032224?locale=en",
"items": [
{
"itemType": "book",
"title": "Black Rock: Mining Folklore of the Pennsylvania Dutch",
"creators": [
{
"firstName": "George",
"lastName": "Korson",
"creatorType": "author"
}
],
"date": "1960",
"ISBN": "9780801803451",
"language": "en",
"libraryCatalog": "ACLS Humanities EBook",
"publisher": "Johns Hopkins UP",
"shortTitle": "Black Rock",
"url": "https://hdl.handle.net/2027/heb.33116",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.fulcrum.org/heb?utf8=%E2%9C%93&press=heb&q=istanbul",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -2,14 +2,14 @@
"translatorID": "f4a5876a-3e53-40e2-9032-d99a30d7a6fc",
"label": "ACLWeb",
"creator": "Guy Aglionby",
"target": "^https?://(www\\.)?aclweb\\.org/anthology/[^#]+",
"target": "^https?://(www\\.)?(aclanthology\\.org|aclweb\\.org/anthology)/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-07-08 09:55:39"
"lastUpdated": "2022-11-10 10:36:48"
}
/*
@ -49,12 +49,19 @@ var ext2mime = {
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
ppt: 'application/vnd.ms-powerpoint',
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
html: 'text/html',
png: 'image/png',
gif: 'image/gif',
jpg: 'image/jpeg',
jpeg: 'image/jpeg',
mp4: 'video/mp4'
mp4: 'video/mp4',
tsv: 'text/tab-separated-values',
csv: 'text/csv',
py: 'text/x-python',
tex: 'text/x-tex',
bbl: 'text/x-tex'
};
function detectWeb(doc, url) {
@ -101,7 +108,7 @@ function doWeb(doc, url) {
}
function scrape(doc) {
let bibtex = ZU.xpath(doc, '//button[contains(text(), "Copy BibTeX to Clipboard")]/@data-clipboard-text')[0].value;
let bibtex = ZU.xpath(doc, '//pre[@id = "citeBibtexContent"]')[0].textContent;
let pdfURL = ZU.xpath(doc, '//a[span[contains(text(), "PDF")]]/@href')[0].value;
let translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
@ -163,7 +170,7 @@ function getVenue(doc, pubTitle) {
// better to use full proceedingsTitle to cite these publications
return '';
}
if (venueString.includes('*SEMEVAL')) {
if (venueString.includes('SemEval')) {
if (pubTitle.includes('SENSEVAL')) {
return 'SENSEVAL ' + year;
}
@ -210,7 +217,7 @@ function getSearchResults(doc, url) {
}
}
else {
let papers = ZU.xpath(doc, '//strong/a[contains(@href, "/anthology/")]');
let papers = ZU.xpath(doc, '//section[@id="main"]//strong/a');
for (let paper of papers) {
items[paper.href] = paper.text;
}
@ -222,22 +229,22 @@ function getSearchResults(doc, url) {
var testCases = [
{
"type": "web",
"url": "https://aclweb.org/anthology/events/acl-2018/",
"url": "https://www.aclanthology.org/events/acl-2018/",
"items": "multiple"
},
{
"type": "web",
"url": "https://aclweb.org/anthology/volumes/P18-1/",
"url": "https://www.aclanthology.org/volumes/P18-1/",
"items": "multiple"
},
{
"type": "web",
"url": "https://aclweb.org/anthology/people/i/iryna-gurevych/",
"url": "https://www.aclanthology.org/people/i/iryna-gurevych/",
"items": "multiple"
},
{
"type": "web",
"url": "https://aclweb.org/anthology/Q18-1001/",
"url": "https://www.aclanthology.org/Q18-1001/",
"items": [
{
"itemType": "journalArticle",
@ -282,7 +289,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/W04-0801/",
"url": "https://www.aclanthology.org/W04-0801/",
"items": [
{
"itemType": "conferencePaper",
@ -341,7 +348,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/W19-0101/",
"url": "https://www.aclanthology.org/W19-0101/",
"items": [
{
"itemType": "conferencePaper",
@ -378,7 +385,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/N12-2001/",
"url": "https://www.aclanthology.org/N12-2001/",
"items": [
{
"itemType": "conferencePaper",
@ -427,7 +434,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/N18-1001/",
"url": "https://www.aclanthology.org/N18-1001/",
"items": [
{
"itemType": "conferencePaper",
@ -508,7 +515,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/2020.lrec-1.2/",
"url": "https://www.aclanthology.org/2020.lrec-1.2/",
"items": [
{
"itemType": "conferencePaper",
@ -538,7 +545,7 @@ var testCases = [
"libraryCatalog": "ACLWeb",
"pages": "1120",
"place": "Marseille, France",
"proceedingsTitle": "Proceedings of The 12th Language Resources and Evaluation Conference",
"proceedingsTitle": "Proceedings of the 12th Language Resources and Evaluation Conference",
"publisher": "European Language Resources Association",
"url": "https://www.aclweb.org/anthology/2020.lrec-1.2",
"attachments": [
@ -555,12 +562,12 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/volumes/2020.lrec-1/",
"url": "https://www.aclanthology.org/volumes/2020.lrec-1/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aclweb.org/anthology/T87-1010.bib",
"url": "https://www.aclanthology.org/T87-1010.bib",
"items": [
{
"itemType": "conferencePaper",

View File

@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-04-20 05:31:35"
"lastUpdated": "2024-07-30 05:19:59"
}
/*
@ -34,10 +34,6 @@
***** END LICENSE BLOCK *****
*/
// attr()/text() v2
// eslint-disable-next-line
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
function detectWeb(doc, url) {
if (isContentUrl(url)) {
let subtypeMatch = getItemSubtype(doc);
@ -154,23 +150,33 @@ function scrape(doc) {
// The (co-)chair(s) or supervisor(s) are included in CSL as additional authors.
cslItem.author.splice(1);
}
if (cslItem.source && (cslItem.source.includes('19') || cslItem.source.includes('20'))) {
// Issue date sometimes goes in source (libraryCatalog)
delete cslItem.source;
}
let item = new Zotero.Item();
ZU.itemFromCSLJSON(item, cslItem);
item.title = ZU.unescapeHTML(item.title);
let abstractElements = doc.querySelectorAll('div.article__abstract p, div.abstractSection p');
let abstract = Array.from(abstractElements).map(x => x.textContent).join('\n\n');
if (abstract.length && abstract.toLowerCase() != 'no abstract available.') {
item.abstractNote = ZU.trimInternal(abstract);
}
let pdfElement = doc.querySelector('a[title=PDF]');
let pdfElement = doc.querySelector('a[title="View PDF"]');
if (pdfElement) {
item.attachments.push({
url: pdfElement.href,
title: 'Full Text PDF',
mimeType: 'application/pdf'
});
if (item.DOI) {
item.url = 'https://dl.acm.org/doi/' + ZU.cleanDOI(item.DOI);
}
}
if (item.itemType == 'journalArticle') {
@ -233,6 +239,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/abs/10.1145/1596655.1596682",
"detectedItemType": "conferencePaper",
"items": [
{
"itemType": "conferencePaper",
@ -241,13 +248,13 @@ var testCases = [
{
"lastName": "Mostafa",
"firstName": "Nagy",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Krintz",
"firstName": "Chandra",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -262,7 +269,7 @@ var testCases = [
"proceedingsTitle": "Proceedings of the 7th International Conference on Principles and Practice of Programming in Java",
"publisher": "Association for Computing Machinery",
"series": "PPPJ '09",
"url": "https://doi.org/10.1145/1596655.1596682",
"url": "https://dl.acm.org/doi/10.1145/1596655.1596682",
"attachments": [
{
"title": "Full Text PDF",
@ -288,6 +295,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/10.5555/1717186",
"detectedItemType": "book",
"items": [
{
"itemType": "book",
@ -296,7 +304,7 @@ var testCases = [
{
"lastName": "Loeliger",
"firstName": "Jon",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -306,6 +314,7 @@ var testCases = [
"edition": "1st",
"itemID": "10.5555/1717186",
"libraryCatalog": "ACM Digital Library",
"numPages": "336",
"publisher": "O'Reilly Media, Inc.",
"shortTitle": "Version Control with Git",
"attachments": [],
@ -318,6 +327,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/abs/10.1023/A:1008286901817",
"detectedItemType": "journalArticle",
"items": [
{
"itemType": "journalArticle",
@ -326,13 +336,13 @@ var testCases = [
{
"lastName": "Tegethoff",
"firstName": "Mick",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Chen",
"firstName": "Tom",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -383,6 +393,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/abs/10.1145/258948.258973",
"detectedItemType": "conferencePaper",
"items": [
{
"itemType": "conferencePaper",
@ -391,13 +402,13 @@ var testCases = [
{
"lastName": "Elliott",
"firstName": "Conal",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Hudak",
"firstName": "Paul",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -412,7 +423,7 @@ var testCases = [
"proceedingsTitle": "Proceedings of the second ACM SIGPLAN international conference on Functional programming",
"publisher": "Association for Computing Machinery",
"series": "ICFP '97",
"url": "https://doi.org/10.1145/258948.258973",
"url": "https://dl.acm.org/doi/10.1145/258948.258973",
"attachments": [
{
"title": "Full Text PDF",
@ -428,6 +439,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/abs/10.1145/2566617",
"detectedItemType": "journalArticle",
"items": [
{
"itemType": "journalArticle",
@ -436,19 +448,19 @@ var testCases = [
{
"lastName": "Joseph",
"firstName": "Kenneth",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Carley",
"firstName": "Kathleen M.",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Hong",
"firstName": "Jason I.",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -463,7 +475,7 @@ var testCases = [
"pages": "46:146:22",
"publicationTitle": "ACM Transactions on Intelligent Systems and Technology",
"shortTitle": "Check-ins in “Blau Space”",
"url": "https://doi.org/10.1145/2566617",
"url": "https://dl.acm.org/doi/10.1145/2566617",
"volume": "5",
"attachments": [
{
@ -493,6 +505,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/abs/10.5555/3336323.C5474411",
"detectedItemType": "bookSection",
"items": [
{
"itemType": "bookSection",
@ -514,8 +527,9 @@ var testCases = [
"creatorType": "author"
}
],
"date": "November 20, 2019",
"ISBN": "9781450372763",
"abstractNote": "This organizational history relates the role of the National Science Foundation (NSF) in the development of modern computing. Drawing upon new and existing oral histories, extensive use of NSF documents, and the experience of two of the authors as senior managers, this book describes how NSF's programmatic activities originated and evolved to become the primary source of funding for fundamental research in computing and information technologies. The book traces how NSF's support has provided facilities and education for computing usage by all scientific disciplines, aided in institution and professional community building, supported fundamental research in computer science and allied disciplines, and led the efforts to broaden participation in computing by all segments of society. Today, the research and infrastructure facilitated by NSF computing programs are significant economic drivers of American society and industry. For example, NSF supported work that led to the first widelyused web browser, Netscape; sponsored the creation of algorithms at the core of the Google search engine; facilitated the growth of the public Internet; and funded research on the scientific basis for countless other applications and technologies. NSF has advanced the development of human capital and ideas for future advances in computing and its applications. This account is the first comprehensive coverage of NSF's role in the extraordinary growth and expansion of modern computing and its use. It will appeal to historians of computing, policy makers and leaders in government and academia, and individuals interested in the history and development of computing and the NSF.",
"abstractNote": "This organizational history relates the role of the National Science Foundation (NSF) in the development of modern computing. Drawing upon new and existing oral histories, extensive use of NSF documents, and the experience of two of the authors as senior managers, this book describes how NSF's programmatic activities originated and evolved to become the primary source of funding for fundamental research in computing and information technologies.The book traces how NSF's support has provided facilities and education for computing usage by all scientific disciplines, aided in institution and professional community building, supported fundamental research in computer science and allied disciplines, and led the efforts to broaden participation in computing by all segments of society.Today, the research and infrastructure facilitated by NSF computing programs are significant economic drivers of American society and industry. For example, NSF supported work that led to the first widelyused web browser, Netscape; sponsored the creation of algorithms at the core of the Google search engine; facilitated the growth of the public Internet; and funded research on the scientific basis for countless other applications and technologies. NSF has advanced the development of human capital and ideas for future advances in computing and its applications.This account is the first comprehensive coverage of NSF's role in the extraordinary growth and expansion of modern computing and its use. It will appeal to historians of computing, policy makers and leaders in government and academia, and individuals interested in the history and development of computing and the NSF.",
"bookTitle": "Computing and the National Science Foundation, 1950--2016: Building a Foundation for Modern Computing",
"itemID": "10.5555/3336323.C5474411",
"libraryCatalog": "ACM Digital Library",
@ -536,6 +550,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/10.1145/3264631.3264634",
"detectedItemType": "journalArticle",
"items": [
{
"itemType": "journalArticle",
@ -544,13 +559,13 @@ var testCases = [
{
"lastName": "Gross",
"firstName": "Mikaylah",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Bolchini",
"firstName": "Davide",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -576,6 +591,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/10.1145/2854146",
"detectedItemType": "journalArticle",
"items": [
{
"itemType": "journalArticle",
@ -584,13 +600,13 @@ var testCases = [
{
"lastName": "Potvin",
"firstName": "Rachel",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
},
{
"lastName": "Levenberg",
"firstName": "Josh",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],
@ -604,7 +620,7 @@ var testCases = [
"libraryCatalog": "ACM Digital Library",
"pages": "7887",
"publicationTitle": "Communications of the ACM",
"url": "https://doi.org/10.1145/2854146",
"url": "https://dl.acm.org/doi/10.1145/2854146",
"volume": "59",
"attachments": [
{
@ -621,6 +637,7 @@ var testCases = [
{
"type": "web",
"url": "https://dl.acm.org/doi/book/10.5555/1087674",
"detectedItemType": "thesis",
"items": [
{
"itemType": "thesis",
@ -629,7 +646,7 @@ var testCases = [
{
"lastName": "Yuan",
"firstName": "Wei",
"creatorTypeID": 1,
"creatorTypeID": 8,
"creatorType": "author"
}
],

391
ACM Queue.js Normal file
View File

@ -0,0 +1,391 @@
{
"translatorID": "212ffcc8-927c-4e84-a097-bd24fd4a44b6",
"label": "ACM Queue",
"creator": "Bogdan Lynn",
"target": "^https://queue\\.acm\\.org/",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2025-12-04 18:10:19"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2025 Bogdan Lynn
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.includes('detail.cfm?id=')) {
return 'journalArticle';
}
else if (getSearchResults(doc, true)) {
return 'multiple';
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('a[href*="detail.cfm?id="]');
for (let row of rows) {
let href = row.href;
// Skip links to specific parts of the article, like #comments,
// since those normally appear below the actual top-level link
if (href.includes("#")) continue;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
async function doWeb(doc, url) {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url));
}
}
else {
await scrape(doc, url);
}
}
async function scrape(doc, url = doc.location.href) {
// DOI can be found in the URL of the PDF link
let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]');
let doi = pdfUrl.href.split("/pdf/")[1];
let translate = Zotero.loadTranslator("search");
// DOI Content Negotiation translator
translate.setTranslator("b28d0d42-8549-4c6d-83fc-8382874a5cb9");
translate.setSearch({ itemType: "journalArticle", DOI: doi });
// Do nothing on error
translate.setHandler("error", () => {});
translate.setHandler("itemDone", (obj, item) => {
item.publicationTitle = "ACM Queue";
item.publisher = "Association for Computing Machinery";
// 'DOI Content Negotiation' translator does not add attachments
let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]');
item.attachments.push({
url: pdfUrl.href,
title: 'Full Text PDF',
mimeType: 'application/pdf'
});
item.complete();
});
// Try to resolve the DOI, and if it does not work, scrape the DOM.
try {
await translate.translate();
return;
}
catch (e) {
Zotero.debug(`Failed to resolve DOI. Scrape the page.`);
}
await scrapeDocument(doc, url);
}
async function scrapeDocument(doc, url) {
let item = new Zotero.Item("journalArticle");
item.title = text(doc, "h1");
item.publicationTitle = "ACM Queue";
item.publisher = "Association for Computing Machinery";
item.journalAbbreviation = "Queue";
item.language = "en";
item.ISSN = "1542-7730";
item.url = url;
// Extract volume and issue from "Volume X, issue Y" at the top
let descriptor = text(doc, ".descriptor").toLowerCase();
let re = /^volume\s+(\d+),\s*issue\s+(\d+)\s*$/i;
let matches = descriptor.match(re) || [];
item.volume = matches[1];
item.issue = matches[2];
// Add PDF attachment and DOI
let pdfUrl = doc.querySelector('a[href*="/doi/pdf"]');
let doi = pdfUrl.href.split("/pdf/")[1];
item.DOI = doi;
item.attachments.push({
url: pdfUrl.href,
title: 'Full Text PDF',
mimeType: 'application/pdf'
});
// Some info needs to be fetched from the page of the entire issue
// because it appears in difference places on the article page
let issueDoc = await requestDocument(attr(doc, ".descriptor", "href"));
// Fetch date
let dateContainer = text(issueDoc, "#lead p");
let date = dateContainer.split(" ").slice(-2).join(" ");
if (date.includes("/")) {
date = date.split("/")[1];
}
item.date = date;
// Find link to the article on the page of the issue
let searchParams = new URLSearchParams(url.split("?")[1]);
let id = searchParams.get("id");
let articleLinkOnissueDoc = issueDoc.querySelector(`a[href*="detail.cfm?id=${id}"]`);
// Fetch abstract below the link
item.abstractNote = articleLinkOnissueDoc.parentNode.nextElementSibling.textContent;
// Fetch creators below the abstract
let potentialAuthors = articleLinkOnissueDoc.parentNode.nextElementSibling.nextElementSibling;
if (potentialAuthors?.classList.contains("meta")) {
let creators = potentialAuthors.textContent.split(",");
for (let creator of creators) {
item.creators.push(ZU.cleanAuthor(creator, "author"));
}
}
item.complete();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://queue.acm.org/detail.cfm?id=3664275",
"items": [
{
"itemType": "journalArticle",
"title": "Make Two Trips: Larry David's New Year's resolution works for IT too.",
"creators": [
{
"creatorType": "author",
"firstName": "Thomas A.",
"lastName": "Limoncelli"
}
],
"date": "2024-04-30",
"DOI": "10.1145/3664275",
"ISSN": "1542-7730, 1542-7749",
"abstractNote": "Whether your project is as simple as carrying groceries into the house or as complex as a multiyear engineering project, \"make two trips\" can simplify the project, reduce the chance of error, improve the probability of success, and lead to easier explanations.",
"issue": "2",
"journalAbbreviation": "Queue",
"language": "en",
"libraryCatalog": "DOI.org (Crossref)",
"pages": "5-14",
"publicationTitle": "ACM Queue",
"shortTitle": "Make Two Trips",
"url": "https://dl.acm.org/doi/10.1145/3664275",
"volume": "22",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://queue.acm.org/detail.cfm?id=3762991",
"items": [
{
"itemType": "journalArticle",
"title": "Understanding the Harm Teens Experience on Social Media",
"creators": [
{
"firstName": "Arturo",
"lastName": "Béjar",
"creatorType": "author"
}
],
"date": "August 2025",
"DOI": "10.1145/3762991",
"ISSN": "1542-7730",
"abstractNote": "The current approach to online safety, focusing on objectively harmful content and deletion or downranking, is necessary but not sufficient, as it addresses only a small fraction of the harm that teens experience. In order to understand harm, it is essential to understand it from their perspective by surveying and creating safety tools and reporting that make it easy to capture what happens and provide immediate help. Many of the recommendations in this article come from what you learn when you analyze behavioral correlates: that you need approaches that rely on conduct in context, better personalization, and providing feedback to actors.",
"issue": "4",
"journalAbbreviation": "Queue",
"language": "en",
"libraryCatalog": "ACM Queue",
"publicationTitle": "ACM Queue",
"url": "https://queue.acm.org/detail.cfm?id=3762991",
"volume": "23",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://queue.acm.org/detail.cfm?id=3546935",
"items": [
{
"itemType": "journalArticle",
"title": "I'm Probably Less Deterministic Than I Used to Be: Embracing randomness is necessary in cloud environments.",
"creators": [
{
"creatorType": "author",
"firstName": "Pat",
"lastName": "Helland"
}
],
"date": "2022-06-30",
"DOI": "10.1145/3546935",
"ISSN": "1542-7730, 1542-7749",
"abstractNote": "In my youth, I thought the universe was ruled by cause and effect like a big clock. In this light, computing made sense. Now I see that both life and computing can be a crapshoot, and that has given me a new peace.",
"issue": "3",
"journalAbbreviation": "Queue",
"language": "en",
"libraryCatalog": "DOI.org (Crossref)",
"pages": "5-13",
"publicationTitle": "ACM Queue",
"shortTitle": "I'm Probably Less Deterministic Than I Used to Be",
"url": "https://dl.acm.org/doi/10.1145/3546935",
"volume": "20",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://queue.acm.org/detail.cfm?id=3501293",
"items": [
{
"itemType": "journalArticle",
"title": "Federated Learning and Privacy",
"creators": [
{
"firstName": "Kallista",
"lastName": "Bonawitz",
"creatorType": "author"
},
{
"firstName": "Peter",
"lastName": "Kairouz",
"creatorType": "author"
},
{
"firstName": "Brendan",
"lastName": "McMahan",
"creatorType": "author"
},
{
"firstName": "Daniel",
"lastName": "Ramage",
"creatorType": "author"
}
],
"date": "September-October 2021",
"DOI": "10.1145/3494834.3501293",
"ISSN": "1542-7730",
"abstractNote": "Centralized data collection can expose individuals to privacy risks and organizations to legal risks if data is not properly managed. Federated learning is a machine learning setting where multiple entities collaborate in solving a machine learning problem, under the coordination of a central server or service provider. Each client's raw data is stored locally and not exchanged or transferred; instead, focused updates intended for immediate aggregation are used to achieve the learning objective. This article provides a brief introduction to key concepts in federated learning and analytics with an emphasis on how privacy technologies may be combined in real-world systems and how their use charts a path toward societal benefit from aggregate statistics in new domains and with minimized risk to individuals and to the organizations who are custodians of the data.",
"issue": "5",
"journalAbbreviation": "Queue",
"language": "en",
"libraryCatalog": "ACM Queue",
"publicationTitle": "ACM Queue",
"url": "https://queue.acm.org/detail.cfm?id=3501293",
"volume": "19",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://queue.acm.org/detail.cfm?id=3773095",
"items": [
{
"itemType": "journalArticle",
"title": "Memory Safety for Skeptics",
"creators": [
{
"firstName": "Andrew Lilley",
"lastName": "Brinker",
"creatorType": "author"
}
],
"date": "October 2025",
"DOI": "10.1145/3773095",
"ISSN": "1542-7730",
"abstractNote": "The state of possibility with memory safety today is similar to the state of automobile safety just prior to the widespread adoption of mandatory seat-belt laws. As car manufacturers began to integrate seat belts as a standard feature across their model lines and states began to require that drivers wear seat belts while driving, the rate of traffic fatalities and severity of traffic-related injuries dropped drastically. Seat belts did not solve automobile safety, but they credibly improved it, and at remarkably low cost.",
"issue": "5",
"journalAbbreviation": "Queue",
"language": "en",
"libraryCatalog": "ACM Queue",
"publicationTitle": "ACM Queue",
"url": "https://queue.acm.org/detail.cfm?id=3773095",
"volume": "23",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://queue.acm.org/issuedetail.cfm?issue=2838344",
"items": "multiple"
},
{
"type": "web",
"url": "https://queue.acm.org/listing.cfm?item_topic=Blockchain&qc_type=theme_list&filter=Blockchain&page_title=Blockchain&order=desc",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -2,76 +2,81 @@
"translatorID": "938ebe32-2b2e-4349-a5b3-b3a05d3de627",
"label": "ACS Publications",
"creator": "Sean Takats, Michael Berkowitz, Santawort, and Aurimas Vinckevicius",
"target": "^https?://pubs\\.acs\\.org/(toc/|journal/|topic/|isbn/\\d|doi/(full/|abs/)?10\\.|action/doSearch\\?)",
"target": "^https?://pubs\\.acs\\.org/(toc/|journal/|topic/|isbn/\\d|doi/(full/|abs/|epdf/|book/)?10\\.|action/(doSearch\\?|showCitFormats\\?.*doi))",
"minVersion": "4.0.5",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2019-10-07 09:04:25"
"lastUpdated": "2024-09-30 13:50:18"
}
/*
***** BEGIN LICENSE BLOCK *****
function getSearchResults(doc, checkOnly, itemOpts) {
Copyright © 2008 Sean Takats, Michael Berkowitz, Santawort, Aurimas
Vinckevicius, Philipp Zumstein, and other contributors.
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function getSearchResults(doc, checkOnly) {
var items = {}, found = false;
var rows = doc.querySelectorAll('.issue-item_title a, .teaser_title a');
for (let i = 0; i < rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
var doi = getDoi(href);
if (!href || !title || !doi) continue;
if (!doi) continue;
if (checkOnly) return true;
found = true;
items[doi] = title;
// Not sure if this is still working on the new websites...
itemOpts[doi] = {};
/*
//check if article contains supporting info,
//so we don't have to waste an HTTP request later if it doesn't
var articleBox = titles[i].parentNode.parentNode;
if (!articleBox.classList.contains('articleBox')) {
// e.g. Most Recently Published under Subject Search
continue;
}
if (ZU.xpath(articleBox, './/a[text()="Supporting Info"]').length) {
itemOpts[doi].hasSupp = true;
}
*/
items[href] = title;
}
return found ? items : false;
}
// Return the DOI indicated by the URL, or null when no DOI is found
// The input should be a properly encoded URL
function getDoi(url) {
var m = url.match(/https?:\/\/[^/]*\/doi\/(?:abs\/|full\/)?(10\.[^?#]+)/);
if (m) {
var doi = m[1];
if (doi.includes("prevSearch")) {
doi = doi.substring(0, doi.indexOf("?"));
}
return decodeURIComponent(doi);
let urlObj = new URL(url);
let doi = decodeURIComponent(urlObj.pathname).match(/^\/doi\/(?:.+\/)?(10\.\d{4,}\/.+)$/);
if (doi) {
doi = doi[1];
}
return false;
else {
doi = urlObj.searchParams.get("doi");
}
return doi;
}
/** ***************************
* BEGIN: Supplementary data *
*****************************/
// Get supplementary file names either from the Supporting Info page or the tooltip
function getSuppFiles(div) {
var fileNames = ZU.xpath(div, './/li//li');
var attach = [];
for (var i = 0, n = fileNames.length; i < n; i++) {
attach.push(fileNames[i].textContent.trim().replace(/\s[\s\S]+/, ''));
}
return attach;
}
var suppTypeMap = {
txt: 'text/plain',
csv: 'text/csv',
bz2: 'application/x-bzip2',
gz: 'application/gzip',
zip: 'application/zip',
pdf: 'application/pdf',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
@ -79,28 +84,33 @@ var suppTypeMap = {
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
};
function getSuppMimeType(fileName) {
var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
var mimeType = suppTypeMap[ext];
return mimeType ? mimeType : undefined;
}
function attachSupp(item, doi, opts) {
if (!opts.attach) return;
if (!item.attachments) item.attachments = [];
var attachment;
for (var i = 0, n = opts.attach.length; i < n; i++) {
attachment = {
title: opts.attach[i]
};
attachment.url = '/doi/suppl/' + doi + '/suppl_file/' + attachment.title;
attachment.mimeType = getSuppMimeType(attachment.title);
if (opts.attachAsLink || !attachment.mimeType) { // don't download unknown file types
attachment.snapshot = false;
}
item.attachments.push(attachment);
function getSupplements(doc, supplementAsLink = false) {
let supplements = [];
// Note that the lists of supplements are duplicated in the main
// content side and right-side panel (if any). We want to confine it to
// one (or the only) side in order to avoid having to deduplicate.
let supplementLinks = doc.querySelectorAll(".article_content-left .suppl-anchor");
for (let i = 0; i < supplementLinks.length; i++) {
let elem = supplementLinks[i];
let url = elem.href;
if (!url) continue;
let pathComponents = url.replace(/[?#].+$/, "").split(".");
// possible location of file extension (following the last dot)
let ext = pathComponents[pathComponents.length - 1].toLowerCase();
let mimeType = suppTypeMap[ext];
// Only save file when MIME type is known *and* when we aren't
// specifically told otherwise
let snapshot = Boolean(!supplementAsLink && mimeType);
// The "title" (text describing what the supplement file is for) can be
// substantially long, while the filename is redundant (and it doesn't
// inform the user that the file is meant to be a supplement). We
// simply number them in the order they appear.
let title = `Supplement ${i + 1}`;
let attachment = { title, url, snapshot };
if (mimeType) attachment.mimeType = mimeType;
supplements.push(attachment);
}
return supplements;
}
/** *************************
@ -111,7 +121,28 @@ function detectWeb(doc, url) {
if (getSearchResults(doc, true)) {
return "multiple";
}
let urlObj = new URL(url);
// standalone "download citation" page
if (urlObj.pathname === "/action/showCitFormats"
&& urlObj.searchParams.get("doi")) {
// May be inaccurate, but better than not detecting
return "journalArticle";
}
// epdf viewer web app
if (urlObj.pathname.startsWith("/doi/epdf/")) {
// TODO: check if "epdf" viewer is always for journal articles
return "journalArticle";
}
// books such as https://pubs.acs.org/doi/book/10.1021/acsguide
if (urlObj.pathname.startsWith("/doi/book/")) {
return "book";
}
if (doc.querySelector("#returnToBook")) {
// Some of them may be conference articles, but the RIS doesn't say so
return "bookSection";
}
else if (getDoi(url)) {
// TODO: check if this block still works
var type = doc.getElementsByClassName("content-navigation__contentType");
if (type.length && type[0].textContent.includes("Chapter")) {
return "bookSection";
@ -123,160 +154,117 @@ function detectWeb(doc, url) {
return false;
}
function doWeb(doc, url) {
var opts = {};
function cleanNumberField(item, field) {
if (item[field]) {
let n = parseInt(item[field]);
if (n <= 0 || isNaN(n)) {
delete item[field];
}
}
}
// In most cases the URL contains the DOI which is sufficient for obtaining the
// RIS, so there's no need to download the document if it's not already there.
// But when supplements as attachments are desired, we need the actual document
// for the supplement links. Our convention here is to pass falsy as the "doc"
// argument when supplements are not requested, and the actual doc (maybe
// fetched by us) when we want the supplements.
async function doWeb(doc, url) {
let attachSupplement = false;
let supplementAsLink = false;
// reduce some overhead by fetching these only once
if (Z.getHiddenPref) {
opts.attachSupp = Z.getHiddenPref("attachSupplementary");
opts.attachAsLink = Z.getHiddenPref("supplementaryAsLink");
attachSupplement = Z.getHiddenPref("attachSupplementary");
supplementAsLink = Z.getHiddenPref("supplementaryAsLink");
}
var itemOpts = {};
if (detectWeb(doc, url) == "multiple") { // search
Zotero.selectItems(getSearchResults(doc, false, itemOpts), function (items) {
if (!items) {
return;
}
var dois = [];
for (let i in items) {
itemOpts[i].pdf = '/doi/pdf/' + i;
dois.push({ doi: i, opts: itemOpts[i] });
}
scrape(dois, opts);
});
}
else { // single article
var doi = getDoi(url);
Zotero.debug("DOI= " + doi);
// we can determine file names from the tooltip, which saves us an HTTP request
var suppTip = doc.getElementById('suppTipDiv');
if (opts.attachSupp && suppTip) {
try {
opts.attach = getSuppFiles(suppTip, opts);
}
catch (e) {
Z.debug("Error getting supplementary files.");
Z.debug(e);
}
let items = await Z.selectItems(getSearchResults(doc));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(
attachSupplement && await requestDocument(url),
url,
supplementAsLink
);
await delay(500);
}
// if we couldn't find this on the individual item page,
// then it doesn't have supp info anyway. This way we know not to check later
if (!opts.attach) opts.attach = [];
itemOpts.pdf = ZU.xpathText(doc, '(//a[i[contains(@class, "icon-file-pdf-o")]]/@href)[1]') || '/doi/pdf/' + doi;
scrape([{ doi: doi, opts: itemOpts }], opts);
}
else {
// single article
await scrape(attachSupplement && doc, url, supplementAsLink);
}
}
function scrape(items, opts) {
for (var i = 0, n = items.length; i < n; i++) {
processCallback(items[i], opts);
}
function delay(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
function processCallback(fetchItem, opts) {
var baseurl = "/action/downloadCitation";
var doi = fetchItem.doi;
var post = "https//pubs.acs.org/action/downloadCitation?direct=true&doi=" + encodeURIComponent(fetchItem.doi) + "&format=ris&include=abs&submit=Download+Citation";
ZU.doPost(baseurl, post, function (text) {
// Fix the RIS doi mapping
text = text.replace("\nN1 - doi:", "\nDO - ");
// Fix the wrong mapping for journal abbreviations
text = text.replace("\nJO -", "\nJ2 -");
// Use publication date when available
if (text.includes("\nDA -")) {
text = text.replace(/\nY1 {2}- [^\n]*/, "")
.replace("\nDA -", "\nY1 -");
}
// Zotero.debug("ris= "+ text);
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function (obj, item) {
if (item.date) {
item.date = ZU.strToISO(item.date);
}
item.attachments = [];
async function scrape(doc, url, supplementAsLink) {
let doi = getDoi(url);
// standard pdf and snapshot
if (fetchItem.opts.pdf) {
if (doc && /\/action\/showCitFormats\?|\/doi\/epdf\//.test(url)) {
// standalone "export citation" page or "epdf viewer", *and*
// supplements are desired; we need to fetch the actual article page
// and scrape that
url = `https://pubs.acs.org/doi/${doi}`;
doc = await requestDocument(url);
}
let risURL = new URL("/action/downloadCitation?include=abs&format=ris&direct=true", url);
risURL.searchParams.set("doi", doi);
risURL.searchParams.set("downloadFileName", doi.replace(/^10\.\d{4,}\//, ""));
let risText = await requestText(risURL.href, { headers: { Referer: url } });
// Delete redundant DOI info
risText = risText.replace(/\nN1 {2}- doi:[^\n]+/, "");
// Fix noise in DO field
risText = risText.replace("\nDO - doi:", "\nDO - ");
// Fix the wrong mapping for journal abbreviations
risText = risText.replace("\nJO -", "\nJ2 -");
// Use publication date when available
if (risText.includes("\nDA -")) {
risText = risText.replace(/\nY1 {2}- [^\n]*/, "")
.replace("\nDA -", "\nY1 -");
}
let translator = Zotero.loadTranslator("import");
// RIS
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(risText);
translator.setHandler("itemDone", function (obj, item) {
if (item.date) {
item.date = ZU.strToISO(item.date);
}
item.attachments = [];
if (/\/doi\/book\//.test(url)) {
// books as standalone items don't have full pdfs (TODO: verify)
if (doc) {
item.attachments.push({
title: "Full Text PDF",
url: fetchItem.opts.pdf,
mimeType: "application/pdf"
title: "Snapshot",
url: url,
mimeType: "text/html"
});
}
}
else {
// standard pdf
item.attachments.push({
title: "ACS Full Text Snapshot",
url: '/doi/full/' + doi,
mimeType: "text/html"
title: "Full Text PDF",
url: `/doi/pdf/${doi}`,
mimeType: "application/pdf"
});
// supplementary data
try {
if (opts.attachSupp && opts.attach) {
// came from individual item page
attachSupp(item, doi, opts);
}
else if (opts.attachSupp && fetchItem.opts.hasSupp) {
// was a search result and has supp info
var suppUrl = '/doi/suppl/' + doi;
if (opts.attachAsLink) {
// if we're only attaching links, it's not worth linking to each doc
item.attachments.push({
title: "Supporting Information",
url: suppUrl,
mimeType: 'text/html',
snapshot: false
});
}
else {
ZU.processDocuments(suppUrl, function (suppDoc) {
try {
var div = suppDoc.getElementById('supInfoBox');
if (div) {
var files = getSuppFiles(div);
attachSupp(item, doi, {
attach: files,
attachAsLink: opts.attachAsLink
});
}
else {
Z.debug("Div not found");
item.attachments.push({
title: "Supporting Information",
url: suppUrl,
mimeType: 'text/html',
snapshot: false
});
}
}
catch (e) {
Z.debug("Error attaching supplementary files.");
Z.debug(e);
}
item.complete();
}, null, function () {
item.complete();
});
return; // don't call item.complete() yet
}
}
}
catch (e) {
Z.debug("Error attaching supplementary files.");
Z.debug(e);
}
item.complete();
});
translator.translate();
}
// supplements
if (doc) {
item.attachments.push(...getSupplements(doc, supplementAsLink));
}
// Cleanup fields that may contain invalid numeric values
cleanNumberField(item, "numberOfVolumes");
cleanNumberField(item, "numPages");
item.complete();
});
await translator.translate();
}
/** BEGIN TEST CASES **/
@ -320,10 +308,6 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "ACS Full Text Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -362,7 +346,6 @@ var testCases = [
"bookTitle": "Aquatic Redox Chemistry",
"extra": "DOI: 10.1021/bk-2011-1071.ch005",
"libraryCatalog": "ACS Publications",
"numberOfVolumes": "0",
"pages": "85-111",
"publisher": "American Chemical Society",
"series": "ACS Symposium Series",
@ -374,10 +357,6 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "ACS Full Text Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -435,10 +414,6 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "ACS Full Text Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -447,11 +422,6 @@ var testCases = [
}
]
},
{
"type": "web",
"url": "https://pubs.acs.org/isbn/9780841239999",
"items": "multiple"
},
{
"type": "web",
"url": "https://pubs.acs.org/journal/acbcct",
@ -461,6 +431,203 @@ var testCases = [
"type": "web",
"url": "https://pubs.acs.org/action/doSearch?text1=zotero&field1=AllField",
"items": "multiple"
},
{
"type": "web",
"url": "https://pubs.acs.org/doi/book/10.1021/acsguide",
"items": [
{
"itemType": "book",
"title": "The ACS Guide to Scholarly Communication",
"creators": [
{
"lastName": "Banik",
"firstName": "Gregory M.",
"creatorType": "author"
},
{
"lastName": "Baysinger",
"firstName": "Grace",
"creatorType": "author"
},
{
"lastName": "Kamat",
"firstName": "Prashant V.",
"creatorType": "author"
},
{
"lastName": "Pienta",
"firstName": "Norbert",
"creatorType": "author"
}
],
"date": "2019-10-02",
"ISBN": "9780841235861",
"extra": "DOI: 10.1021/acsguide",
"libraryCatalog": "ACS Publications",
"publisher": "American Chemical Society",
"series": "ACS Guide to Scholarly Communication",
"url": "https://doi.org/10.1021/acsguide",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://pubs.acs.org/action/showCitFormats?doi=10.1021%2Facscentsci.3c00243",
"items": [
{
"itemType": "journalArticle",
"title": "Generic Platform for the Multiplexed Targeted Electrochemical Detection of Osteoporosis-Associated Single Nucleotide Polymorphisms Using Recombinase Polymerase Solid-Phase Primer Elongation and Ferrocene-Modified Nucleoside Triphosphates",
"creators": [
{
"lastName": "Ortiz",
"firstName": "Mayreli",
"creatorType": "author"
},
{
"lastName": "Jauset-Rubio",
"firstName": "Miriam",
"creatorType": "author"
},
{
"lastName": "Trummer",
"firstName": "Olivia",
"creatorType": "author"
},
{
"lastName": "Foessl",
"firstName": "Ines",
"creatorType": "author"
},
{
"lastName": "Kodr",
"firstName": "David",
"creatorType": "author"
},
{
"lastName": "Acero",
"firstName": "Josep Lluís",
"creatorType": "author"
},
{
"lastName": "Botero",
"firstName": "Mary Luz",
"creatorType": "author"
},
{
"lastName": "Biggs",
"firstName": "Phil",
"creatorType": "author"
},
{
"lastName": "Lenartowicz",
"firstName": "Daniel",
"creatorType": "author"
},
{
"lastName": "Trajanoska",
"firstName": "Katerina",
"creatorType": "author"
},
{
"lastName": "Rivadeneira",
"firstName": "Fernando",
"creatorType": "author"
},
{
"lastName": "Hocek",
"firstName": "Michal",
"creatorType": "author"
},
{
"lastName": "Obermayer-Pietsch",
"firstName": "Barbara",
"creatorType": "author"
},
{
"lastName": "OSullivan",
"firstName": "Ciara K.",
"creatorType": "author"
}
],
"date": "2023-08-23",
"DOI": "10.1021/acscentsci.3c00243",
"ISSN": "2374-7943",
"abstractNote": "Osteoporosis is a multifactorial disease influenced by genetic and environmental factors, which contributes to an increased risk of bone fracture, but early diagnosis of this disease cannot be achieved using current techniques. We describe a generic platform for the targeted electrochemical genotyping of SNPs identified by genome-wide association studies to be associated with a genetic predisposition to osteoporosis. The platform exploits isothermal solid-phase primer elongation with ferrocene-labeled nucleoside triphosphates. Thiolated reverse primers designed for each SNP were immobilized on individual gold electrodes of an array. These primers are designed to hybridize to the SNP site at their 3OH terminal, and primer elongation occurs only where there is 100% complementarity, facilitating the identification and heterozygosity of each SNP under interrogation. The platform was applied to real blood samples, which were thermally lysed and directly used without the need for DNA extraction or purification. The results were validated using Taqman SNP genotyping assays and Sanger sequencing. The assay is complete in just 15 min with a total cost of 0.3€ per electrode. The platform is completely generic and has immense potential for deployment at the point of need in an automated device for targeted SNP genotyping with the only required end-user intervention being sample addition.",
"issue": "8",
"journalAbbreviation": "ACS Cent. Sci.",
"libraryCatalog": "ACS Publications",
"pages": "1591-1602",
"publicationTitle": "ACS Central Science",
"url": "https://doi.org/10.1021/acscentsci.3c00243",
"volume": "9",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://pubs.acs.org/doi/epdf/10.1021/acscentsci.3c00323",
"items": [
{
"itemType": "journalArticle",
"title": "Dynamics of Rayleigh Fission Processes in 100 nm Charged Aqueous Nanodrops",
"creators": [
{
"lastName": "Hanozin",
"firstName": "Emeline",
"creatorType": "author"
},
{
"lastName": "Harper",
"firstName": "Conner C.",
"creatorType": "author"
},
{
"lastName": "McPartlan",
"firstName": "Matthew S.",
"creatorType": "author"
},
{
"lastName": "Williams",
"firstName": "Evan R.",
"creatorType": "author"
}
],
"date": "2023-08-23",
"DOI": "10.1021/acscentsci.3c00323",
"ISSN": "2374-7943",
"abstractNote": "Fission of micron-size charged droplets has been observed using optical methods, but little is known about fission dynamics and breakup of smaller nanosize droplets that are important in a variety of natural and industrial processes. Here, spontaneous fission of individual aqueous nanodrops formed by electrospray is investigated using charge detection mass spectrometry. Fission processes ranging from formation of just two progeny droplets in 2 ms to production of dozens of progeny droplets over 100+ ms are observed for nanodrops that are charged above the Rayleigh limit. These results indicate that Rayleigh fission is a continuum of processes that produce progeny droplets that vary widely in charge, mass, and number.",
"issue": "8",
"journalAbbreviation": "ACS Cent. Sci.",
"libraryCatalog": "ACS Publications",
"pages": "1611-1622",
"publicationTitle": "ACS Central Science",
"url": "https://doi.org/10.1021/acscentsci.3c00323",
"volume": "9",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

664
ADS Bibcode.js Normal file
View File

@ -0,0 +1,664 @@
{
"translatorID": "09bd8037-a9bb-4f9a-b3b9-d18b2564b49e",
"label": "ADS Bibcode",
"creator": "Abe Jellinek",
"target": "",
"minVersion": "6.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 8,
"lastUpdated": "2025-04-29 03:02:00"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
// Logic for accurate type detection. In general, the type in the RIS export is
// fairly accurate. However, it may misidentify a proceedings book as JOUR (but
// usually identifies conference papers fine). Theses are also identified as
// JOUR in the RIS file. Preprints are usually correctly identified.
function getRealType(bibStem, exportType) {
if (/^(PhDT|MsT)/.test(bibStem)) {
return "thesis";
}
// Fix misidentifying full proceedings book as JOUR
let volume = bibStem.substring(5, 9);
if (volume === "conf" && exportType === "journalArticle") {
return "book";
}
return exportType;
}
// https://github.com/yymao/adstex/blob/64989c9e75d7401ea2b33b546664cbc34cce6a27/adstex.py
const bibcodeRe = /^\d{4}\D\S{13}[A-Z.:]$/;
function detectSearch(items) {
return !!filterQuery(items).length;
}
async function doSearch(items) {
let bibcodes = filterQuery(items);
if (!bibcodes.length) return;
await scrape(bibcodes);
}
function filterQuery(items) {
if (!items) return [];
if (!items.length) items = [items];
// filter out invalid queries
let bibcodes = [];
for (let item of items) {
if (item.adsBibcode && typeof item.adsBibcode == 'string') {
let bibcode = item.adsBibcode.trim();
if (bibcodeRe.test(bibcode)) {
bibcodes.push(bibcode);
}
}
}
return bibcodes;
}
function extractId(url) {
let m = url.match(/\/abs\/([^/]+)/);
return m && decodeURIComponent(m[1]);
}
function makePdfUrl(id) {
return "https://ui.adsabs.harvard.edu/link_gateway/" + id + "/ARTICLE";
}
// Detect if an item is from arXiv. This is necessary because bibcodes of older
// arXiv preprints don't start with "arXiv"
function isArXiv(item, bibStem) {
if (item.DOI && item.DOI.startsWith("10.48550/")) return true;
if (bibStem.startsWith("arXiv")) return true;
return false;
}
async function scrape(ids) {
let bootstrap = await requestJSON("https://api.adsabs.harvard.edu/v1/accounts/bootstrap");
if (!bootstrap || !bootstrap.access_token) {
throw new Error("ADS Bibcode: cannot obtain access token");
}
let body = JSON.stringify({ bibcode: ids, sort: ['no sort'] });
let response = await requestJSON("https://api.adsabs.harvard.edu/v1/export/ris", {
method: "POST",
body,
headers: {
Accept: "application/json",
Authorization: `Bearer ${bootstrap.access_token}`,
"Content-Type": "application/json",
},
});
let translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); // RIS
translator.setString(response.export);
translator.setHandler("itemDone", function (obj, item) {
let id = extractId(item.url);
let bibStem = id.slice(4);
let type = getRealType(bibStem, item.itemType);
if (type !== item.itemType) {
Z.debug(`ADS Bibcode: changing item type: ${item.itemType} -> ${type}`);
item.itemType = type;
}
if (isArXiv(item, bibStem)) {
item.itemType = "preprint";
item.publisher = "arXiv";
delete item.pages;
delete item.publicationTitle;
delete item.journalAbbreviation;
}
item.extra = (item.extra || '') + `\nADS Bibcode: ${id}`;
// for thesis-type terminology, see
// https://adsabs.harvard.edu/abs_doc/journals1.html
if (item.itemType === "thesis") {
if (bibStem.startsWith("PhDT")) {
item.thesisType = "Ph.D. thesis";
}
else if (bibStem.startsWith("MsT")) {
item.thesisType = "Masters thesis";
}
delete item.journalAbbreviation; // from spurious JO tag
delete item.publicationTitle;
}
item.attachments.push({
url: makePdfUrl(id),
title: "Full Text PDF",
mimeType: "application/pdf"
});
if (item.journalAbbreviation == item.publicationTitle) {
delete item.journalAbbreviation;
}
if (item.date) {
item.date = ZU.strToISO(item.date);
}
item.libraryCatalog = 'NASA ADS';
item.complete();
});
await translator.translate();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "search",
"input": {
"adsBibcode": "2022MSSP..16208070W"
},
"items": [
{
"itemType": "journalArticle",
"title": "Research and application of neural network for tread wear prediction and optimization",
"creators": [
{
"lastName": "Wang",
"firstName": "Meiqi",
"creatorType": "author"
},
{
"lastName": "Jia",
"firstName": "Sixian",
"creatorType": "author"
},
{
"lastName": "Chen",
"firstName": "Enli",
"creatorType": "author"
},
{
"lastName": "Yang",
"firstName": "Shaopu",
"creatorType": "author"
},
{
"lastName": "Liu",
"firstName": "Pengfei",
"creatorType": "author"
},
{
"lastName": "Qi",
"firstName": "Zhuang",
"creatorType": "author"
}
],
"date": "2022-01-01",
"DOI": "10.1016/j.ymssp.2021.108070",
"ISSN": "0888-3270",
"abstractNote": "The wheel tread wear of heavy haul freight car in operation leads to shortened wheel turning period, reduced operation life, and poor train operation performance. In addition, wheel rail wear is a complex non-linear problem that integrates multiple disciplines. Thus, using a single physical or mathematical model to accurately describe and predict it is difficult. How to establish a model that could accurately predict wheel tread wear is an urgent problem and challenge that needs to be solved. In this paper, a tread wear prediction and optimization method based on chaotic quantum particle swarm optimization (CQPSO)-optimized derived extreme learning machine (DELM), namely CQPSO-DELM, is proposed to overcome this problem. First, an extreme learning machine model with derivative characteristics is proposed (DELM). Next, the chaos algorithm is introduced into the quantum particle swarm optimization algorithm to optimize the parameters of DELM. Then, through the CQPSO-DELM prediction model, the vehicle dynamics model simulates the maximum wheel tread wear under different test parameters to train and predict. Results show that the error performance index of the CQPSO-DELM prediction model is smaller than that of other algorithms. Thus, it could better reflect the influence of different parameters on the value of wheel tread wear. CQPSO is used to optimize the tread coordinates to obtain a wheel profile with low wear. The optimized wheel profile is fitted and reconstructed by the cubic non-uniform rational B-spline (NURBS) theory, and the optimized wear value of the tread is compared with the original wear value. The optimized wear value is less than the original wear value, thus verifying the effectiveness of the optimization model. The CQPSO-DELM model proposed in this paper could predict the wear value of different working conditions and tree shapes and solve the problem that different operating conditions and complex environment could have a considerable effect on the prediction of tread wear value. The optimization of wheel tread and the wear prediction of different tread shapes are realized from the angle of artificial intelligence for the first time.",
"extra": "ADS Bibcode: 2022MSSP..16208070W",
"libraryCatalog": "NASA ADS",
"pages": "108070",
"publicationTitle": "Mechanical Systems and Signal Processing",
"url": "https://ui.adsabs.harvard.edu/abs/2022MSSP..16208070W",
"volume": "162",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "00-01"
},
{
"tag": "99-00"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "2021PhDT.........5C"
},
"items": [
{
"itemType": "thesis",
"title": "Searching for the Astrophysical Gravitational-Wave Background and Prompt Radio Emission from Compact Binaries",
"creators": [
{
"lastName": "Callister",
"firstName": "Thomas A.",
"creatorType": "author"
}
],
"date": "2021-06-01",
"abstractNote": "Gravitational-wave astronomy is now a reality. During my time at Caltech, the Advanced LIGO and Virgo observatories have detected gravitational waves from dozens of compact binary coalescences. All of these gravitational-wave events occurred in the relatively local Universe. In the first part of this thesis, I will instead look towards the remote Universe, investigating what LIGO and Virgo may be able to learn about cosmologically-distant compact binaries via observation of the stochastic gravitational-wave background. The stochastic gravitational-wave background is composed of the incoherent superposition of all distant, individually-unresolvable gravitational-wave sources. I explore what we learn from study of the gravitational-wave background, both about the astrophysics of compact binaries and the fundamental nature of gravitational waves. Of course, before we can study the gravitational-wave background we must first detect it. I therefore present searches for the gravitational-wave background using data from Advanced LIGO's first two observing runs, obtaining the most stringent upper limits to date on strength of the stochastic background. Finally, I consider how one might validate an apparent detection of the gravitational-wave background, confidently distinguishing a true astrophysical signal from spurious terrestrial artifacts. The second part of this thesis concerns the search for electromagnetic counterparts to gravitational-wave events. The binary neutron star merger GW170817 was accompanied by a rich set of electromagnetic counterparts spanning nearly the entire electromagnetic spectrum. Beyond these counterparts, compact binaries may additionally generate powerful radio transients at or near their time of merger. First, I consider whether there is a plausible connection between this so-called \"prompt radio emission\" and fast radio bursts — enigmatic radio transients of unknown origin. Next, I present the first direct search for prompt radio emission from a compact binary merger using the Owens Valley Radio Observatory Long Wavelength Array (OVRO-LWA). While no plausible candidates are identified, this effort successfully demonstrates the prompt radio follow-up of a gravitational-wave source, providing a blueprint for LIGO and Virgo follow-up in their O3 observing run and beyond.",
"extra": "ADS Bibcode: 2021PhDT.........5C",
"libraryCatalog": "NASA ADS",
"thesisType": "Ph.D. thesis",
"url": "https://ui.adsabs.harvard.edu/abs/2021PhDT.........5C",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "2021wfc..rept....8D"
},
"items": [
{
"itemType": "report",
"title": "WFC3 IR Blob Classification with Machine Learning",
"creators": [
{
"lastName": "Dauphin",
"firstName": "F.",
"creatorType": "author"
},
{
"lastName": "Medina",
"firstName": "J. V.",
"creatorType": "author"
},
{
"lastName": "McCullough",
"firstName": "P. R.",
"creatorType": "author"
}
],
"date": "2021-06-01",
"abstractNote": "IR blobs are small, circular, dark artifacts in WFC3 IR images caused by particulates that occasionally are deposited on a flat mirror that is nearly optically conjugate to the IR detector. Machine learning can potentially reduce the effort currently devoted to visually inspecting blobs. We describe how machine learning (ML) techniques have been implemented to develop software that will automatically find new IR blobs and notify the WFC3 Quicklook team. This report describes the data preparation, development of the ML model, and criteria for success. The results of our latest test cases demonstrate that the model finds blobs reliably, with the model correctly classifying blob and non-blob images 94% and 88% of the time, respectively. We also report tips and lessons learned from our experience in machine learning as a result of this project.",
"extra": "ADS Bibcode: 2021wfc..rept....8D",
"libraryCatalog": "NASA ADS",
"pages": "8",
"url": "https://ui.adsabs.harvard.edu/abs/2021wfc..rept....8D",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Blobs"
},
{
"tag": "Convolutional Neural Networks"
},
{
"tag": "HST"
},
{
"tag": "Hubble Space Telescope"
},
{
"tag": "IR"
},
{
"tag": "Machine Learning"
},
{
"tag": "STScI"
},
{
"tag": "Space Telescope Science Institute"
},
{
"tag": "WFC3"
},
{
"tag": "Wide Field Camera 3"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "2021sti..book.....P"
},
"items": [
{
"itemType": "book",
"title": "Stochastic Thermodynamics: An Introduction",
"creators": [
{
"lastName": "Peliti",
"firstName": "Luca",
"creatorType": "author"
},
{
"lastName": "Pigolotti",
"firstName": "Simone",
"creatorType": "author"
}
],
"date": "2021-07-01",
"abstractNote": "The first comprehensive graduate-level introduction to stochastic thermodynamics. Stochastic thermodynamics is a well-defined subfield of statistical physics that aims to interpret thermodynamic concepts for systems ranging in size from a few to hundreds of nanometers, the behavior of which is inherently random due to thermal fluctuations. This growing field therefore describes the nonequilibrium dynamics of small systems, such as artificial nanodevices and biological molecular machines, which are of increasing scientific and technological relevance. This textbook provides an up-to-date pedagogical introduction to stochastic thermodynamics, guiding readers from basic concepts in statistical physics, probability theory, and thermodynamics to the most recent developments in the field. Gradually building up to more advanced material, the authors consistently prioritize simplicity and clarity over exhaustiveness and focus on the development of readers' physical insight over mathematical formalism. This approach allows the reader to grow as the book proceeds, helping interested young scientists to enter the field with less effort and to contribute to its ongoing vibrant development. Chapters provide exercises to complement and reinforce learning. Appropriate for graduate students in physics and biophysics, as well as researchers, Stochastic Thermodynamics serves as an excellent initiation to this rapidly evolving field. Emphasizes a pedagogical approach to the subject Highlights connections with the thermodynamics of information Pays special attention to molecular biophysics applications Privileges physical intuition over mathematical formalism Solutions manual available on request for instructors adopting the book in a course",
"extra": "ADS Bibcode: 2021sti..book.....P",
"libraryCatalog": "NASA ADS",
"shortTitle": "Stochastic Thermodynamics",
"url": "https://ui.adsabs.harvard.edu/abs/2021sti..book.....P",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "2020jsrs.conf.....B"
},
"items": [
{
"itemType": "book",
"title": "Proceedings of the Journées Systèmes de Référence Spatio-temporels 2019 \"Astrometry, Earth Rotation and Reference System in the Gaia era\"",
"creators": [
{
"lastName": "Bizouard",
"firstName": "Christian",
"creatorType": "author"
}
],
"date": "2020-09-01",
"extra": "ADS Bibcode: 2020jsrs.conf.....B",
"libraryCatalog": "NASA ADS",
"url": "https://ui.adsabs.harvard.edu/abs/2020jsrs.conf.....B",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "2020jsrs.conf..209S"
},
"items": [
{
"itemType": "conferencePaper",
"title": "Atmospheric angular momentum related to Earth rotation studies: history and modern developments",
"creators": [
{
"lastName": "Salstein",
"firstName": "D.",
"creatorType": "author"
}
],
"date": "2020-09-01",
"abstractNote": "It was noted some time ago that the angular momentum of the atmosphere varies, both regionally as well as in total. Given the conservation of angular momentum in the Earth system, except for known external torques, such variability implies transfer of the angular momentum across the atmosphere's lower boundary. As nearly all is absorbed by the Earth below, the solid Earth changes its overall rotation from this impact. Due to the large difference between in the moments of inertia of the atmosphere and Earth, relatively big differences in the atmosphere are translated as relatively very small differences in the Earth, measurable as changes in Earth rotation rate, and polar motion. The atmospheric angular momentum (AAM) is that due to the motion of the winds and to the changes in mass distribution, closely related to the atmosphere pressure patterns; its variability in the atmosphere is mirrored in the Earth rotation rate and polar motion. This connection between the global solid Earth properties and the global and regional atmosphere on a number of time scales, especially seasonal and interannual, was much appreciated by Barbara Kolaczek, with Jolanta Nastula, at the Space Research Center in Warsaw, and this was a subject of our collaborative studies. Many calculations were made of atmospheric angular momentum, leading to a service under the Global Geophysical Fluids Center of the IERS based on calculations using both operational meteorological series, determined for weather forecasting purposes, and retrospective analyses of the atmosphere. Theoretical development of the connection between the AAM, Earth rotation/polar motion, and also the angular momentum of the other geophysical fluids occurred at the same time that space-based observations and enhanced computer power were allowing improved skills for both weather analysis and forecasting. Hence better determination of the AAM became possible, which could be used as a measure for forecasting Earth rotation. Today we are looking at the atmosphere in combination with the ocean and other fluids, and also assessing the implications of climate variability on Earth rotation through climate model research. According to models of the Earth system, significant changes in winds appear to be a possible result of climate change, with implications for the Earth rotation parameters.",
"conferenceName": "Astrometry, Earth Rotation, and Reference Systems in the GAIA era",
"extra": "ADS Bibcode: 2020jsrs.conf..209S",
"libraryCatalog": "NASA ADS",
"pages": "209-213",
"shortTitle": "Atmospheric angular momentum related to Earth rotation studies",
"url": "https://ui.adsabs.harvard.edu/abs/2020jsrs.conf..209S",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": [
{
"adsBibcode": "2002math.....11159P"
},
{
"adsBibcode": "2003math......3109P"
}
],
"items": [
{
"itemType": "preprint",
"title": "The entropy formula for the Ricci flow and its geometric applications",
"creators": [
{
"lastName": "Perelman",
"firstName": "Grisha",
"creatorType": "author"
}
],
"date": "2002-11-01",
"DOI": "10.48550/arXiv.math/0211159",
"abstractNote": "We present a monotonic expression for the Ricci flow, valid in all dimensions and without curvature assumptions. It is interpreted as an entropy for a certain canonical ensemble. Several geometric applications are given. In particular, (1) Ricci flow, considered on the space of riemannian metrics modulo diffeomorphism and scaling, has no nontrivial periodic orbits (that is, other than fixed points); (2) In a region, where singularity is forming in finite time, the injectivity radius is controlled by the curvature; (3) Ricci flow can not quickly turn an almost euclidean region into a very curved one, no matter what happens far away. We also verify several assertions related to Richard Hamilton's program for the proof of Thurston geometrization conjecture for closed three-manifolds, and give a sketch of an eclectic proof of this conjecture, making use of earlier results on collapsing with local lower curvature bound.",
"extra": "ADS Bibcode: 2002math.....11159P",
"libraryCatalog": "NASA ADS",
"repository": "arXiv",
"url": "https://ui.adsabs.harvard.edu/abs/2002math.....11159P",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "53C"
},
{
"tag": "Differential Geometry"
}
],
"notes": [],
"seeAlso": []
},
{
"itemType": "preprint",
"title": "Ricci flow with surgery on three-manifolds",
"creators": [
{
"lastName": "Perelman",
"firstName": "Grisha",
"creatorType": "author"
}
],
"date": "2003-03-01",
"DOI": "10.48550/arXiv.math/0303109",
"abstractNote": "This is a technical paper, which is a continuation of math.DG/0211159. Here we construct Ricci flow with surgeries and verify most of the assertions, made in section 13 of that e-print; the exceptions are (1) the statement that manifolds that can collapse with local lower bound on sectional curvature are graph manifolds - this is deferred to a separate paper, since the proof has nothing to do with the Ricci flow, and (2) the claim on the lower bound for the volume of maximal horns and the smoothness of solutions from some time on, which turned out to be unjustified and, on the other hand, irrelevant for the other conclusions.",
"extra": "ADS Bibcode: 2003math......3109P",
"libraryCatalog": "NASA ADS",
"repository": "arXiv",
"url": "https://ui.adsabs.harvard.edu/abs/2003math......3109P",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "53C"
},
{
"tag": "Differential Geometry"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "1995LNP...463...51E"
},
"items": [
{
"itemType": "bookSection",
"title": "Observations and Cosmological Models",
"creators": [
{
"lastName": "Ellis",
"firstName": "G. F. R.",
"creatorType": "author"
}
],
"date": "1995-01-01",
"bookTitle": "Galaxies in the Young Universe",
"extra": "DOI: 10.1007/BFb0102359\nADS Bibcode: 1995LNP...463...51E",
"libraryCatalog": "NASA ADS",
"pages": "51",
"url": "https://ui.adsabs.harvard.edu/abs/1995LNP...463...51E",
"volume": "463",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "search",
"input": {
"adsBibcode": "1997MsT...........B"
},
"items": [
{
"itemType": "thesis",
"title": "Comparative Analysis of Selected Radiation Effects in Medium Earth Orbits",
"creators": [
{
"lastName": "Bolin",
"firstName": "Jennifer A.",
"creatorType": "author"
}
],
"date": "1997-12-01",
"abstractNote": "Satellite design is well developed for the common Low Earth Orbit (LEO) and Geosynchronous Orbit (GEO) and Highly Elliptical Orbits (HEO), i.e., Molniya, cases; Medium Earth Orbit (MEO) satellite design is a relatively new venture. MEO is roughly defined as being altitudes above LEO and below GEO. A primary concern, and a major reason for the delay in exploiting the MEO altitudes, has been the expected radiation environment and corresponding satellite degradation anticipated to occur at MEO altitudes. The presence of the Van Allen belts, a major source of radiation, along with the suitability of GEO and LEO orbits, has conventionally discouraged satellite placement in MEO. As conventional Earth orbits become increasingly crowded, MEO will become further populated. This thesis investigates the major sources of radiation (geomagnetically trapped particles, solar particle events and galactic cosmic radiation) with respect to specific Naval Research Laboratory (NRL) designated MEO (altitudes between 3,000 nautical miles (nmi) and 9,000 nmi; (inclination angle of 15 degrees). The contribution of each of these components to the total radiation experienced in MEO and the effects of the expected radiation on a representative spacecraft are analyzed in comparison to a baseline LEO orbit of 400 nmi and 70 degrees inclination. Dose depth curves are calculated for several configurations, and show that weight gains from necessary expected shielding are not extreme. The radiation effects considered include proton displacement dose and solar cell degradation.",
"extra": "ADS Bibcode: 1997MsT...........B",
"libraryCatalog": "NASA ADS",
"thesisType": "Masters thesis",
"url": "https://ui.adsabs.harvard.edu/abs/1997MsT...........B",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Aerospace Environments"
},
{
"tag": "Astrophysics"
},
{
"tag": "Cosmic Rays"
},
{
"tag": "Degradation"
},
{
"tag": "Elliptical Orbits"
},
{
"tag": "Galactic Radiation"
},
{
"tag": "Geosynchronous Orbits"
},
{
"tag": "Low Earth Orbits"
},
{
"tag": "Radiation Belts"
},
{
"tag": "Radiation Effects"
},
{
"tag": "Satellite Design"
},
{
"tag": "Solar Activity"
},
{
"tag": "Solar Cells"
},
{
"tag": "Solar Corpuscular Radiation"
},
{
"tag": "Solar Storms"
},
{
"tag": "Unmanned Spacecraft"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-08-27 10:23:44"
"lastUpdated": "2025-05-08 17:43:18"
}
/*
@ -93,6 +93,13 @@ function scrape(doc, url) {
//and another text node with the actual abstract.
var abstract = ZU.xpathText(doc, '//section[contains(@class,"abstract")]/text()[last()]');
item.abstractNote = abstract;
for (let jelCode of doc.querySelectorAll('.jel-codes .code')) {
let jelTag = jelCode.nextSibling;
if (jelTag && jelTag.textContent.trim()) {
item.tags.push({ tag: jelTag.textContent.trim() });
}
}
item.complete();
});
@ -102,7 +109,7 @@ function scrape(doc, url) {
}
/** BEGIN TEST CASES **/
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
@ -133,6 +140,7 @@ var testCases = [
"ISSN": "0895-3309",
"abstractNote": "As economists endeavor to build better models of human behavior, they cannot ignore that humans are fundamentally a social species with interaction patterns that shape their behaviors. People's opinions, which products they buy, whether they invest in education, become criminals, and so forth, are all influenced by friends and acquaintances. Ultimately, the full network of relationships—how dense it is, whether some groups are segregated, who sits in central positions—affects how information spreads and how people behave. Increased availability of data coupled with increased computing power allows us to analyze networks in economic settings in ways not previously possible. In this paper, I describe some of the ways in which networks are helping economists to model and understand behavior. I begin with an example that demonstrates the sorts of things that researchers can miss if they do not account for network patterns of interaction. Next I discuss a taxonomy of network properties and how they impact behaviors. Finally, I discuss the problem of developing tractable models of network formation.",
"issue": "4",
"language": "en",
"libraryCatalog": "www.aeaweb.org",
"pages": "3-22",
"publicationTitle": "Journal of Economic Perspectives",
@ -142,12 +150,46 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot"
}
],
"tags": [],
"tags": [
{
"tag": "Belief"
},
{
"tag": "Communication"
},
{
"tag": "Consumer Economics: Theory"
},
{
"tag": "Consumer Economics: Theory, Search"
},
{
"tag": "Economic Anthropology"
},
{
"tag": "Economic Sociology; Economic Anthropology; Social and Economic Stratification"
},
{
"tag": "Information and Knowledge"
},
{
"tag": "Learning"
},
{
"tag": "Network Formation and Analysis: Theory"
},
{
"tag": "Search; Learning; Information and Knowledge; Communication; Belief; Unawareness"
},
{
"tag": "Social and Economic Stratification"
},
{
"tag": "Unawareness, Network Formation and Analysis: Theory, Economic Sociology"
}
],
"notes": [],
"seeAlso": []
}
@ -177,6 +219,7 @@ var testCases = [
"ISSN": "0002-8282",
"abstractNote": "Using a model of statistical discrimination and educational sorting,\nwe explain why blacks get more education than whites of similar\ncognitive ability, and we explore how the Armed Forces Qualification\nTest (AFQT), wages, and education are related. The model suggests\nthat one should control for both AFQT and education when comparing\nthe earnings of blacks and whites, in which case a substantial\nblack-white wage differential emerges. We reject the hypothesis that\ndifferences in school quality between blacks and whites explain the\nwage and education differentials. Our findings support the view that\nsome of the black-white wage differential reflects the operation of the\nlabor market. (JEL I21, J15, J24, J31, J71)",
"issue": "4",
"language": "en",
"libraryCatalog": "www.aeaweb.org",
"pages": "1467-1496",
"publicationTitle": "American Economic Review",
@ -186,12 +229,43 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot"
}
],
"tags": [],
"tags": [
{
"tag": "Analysis of Education"
},
{
"tag": "Analysis of Education, Economics of Minorities and Races"
},
{
"tag": "Economics of Minorities and Races; Non-labor Discrimination"
},
{
"tag": "Human Capital; Skills; Occupational Choice; Labor Productivity"
},
{
"tag": "Labor Discrimination"
},
{
"tag": "Labor Productivity, Wage Level and Structure"
},
{
"tag": "Non-labor Discrimination, Human Capital"
},
{
"tag": "Occupational Choice"
},
{
"tag": "Skills"
},
{
"tag": "Wage Differentials, Labor Discrimination"
},
{
"tag": "Wage Level and Structure; Wage Differentials"
}
],
"notes": [],
"seeAlso": []
}
@ -221,6 +295,7 @@ var testCases = [
"ISSN": "0895-3309",
"abstractNote": "We can imagine a plausible case for government support of science based on traditional economic reasons of externalities and public goods. Yet when it comes to government support of grants from the National Science Foundation (NSF) for economic research, our sense is that many economists avoid critical questions, skimp on analysis, and move straight to advocacy. In this essay, we take a more skeptical attitude toward the efforts of the NSF to subsidize economic research. We offer two main sets of arguments. First, a key question is not whether NSF funding is justified relative to laissez-faire, but rather, what is the marginal value of NSF funding given already existing government and nongovernment support for economic research? Second, we consider whether NSF funding might more productively be shifted in various directions that remain within the legal and traditional purview of the NSF. Such alternative focuses might include data availability, prizes rather than grants, broader dissemination of economic insights, and more. Given these critiques, we suggest some possible ways in which the pattern of NSF funding, and the arguments for such funding, might be improved.",
"issue": "3",
"language": "en",
"libraryCatalog": "www.aeaweb.org",
"pages": "235-248",
"publicationTitle": "Journal of Economic Perspectives",
@ -230,16 +305,146 @@ var testCases = [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "Snapshot"
}
],
"tags": [],
"tags": [
{
"tag": "Higher Education; Research Institutions"
},
{
"tag": "Market for Economists, Higher Education"
},
{
"tag": "Research Institutions, Technological Change: Government Policy"
},
{
"tag": "Role of Economics"
},
{
"tag": "Role of Economics; Role of Economists; Market for Economists"
},
{
"tag": "Role of Economists"
},
{
"tag": "Technological Change: Government Policy"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.aeaweb.org/articles?id=10.1257/jel.20201641",
"items": [
{
"itemType": "journalArticle",
"title": "The 1918 Influenza Pandemic and Its Lessons for COVID-19",
"creators": [
{
"firstName": "Brian",
"lastName": "Beach",
"creatorType": "author"
},
{
"firstName": "Karen",
"lastName": "Clay",
"creatorType": "author"
},
{
"firstName": "Martin",
"lastName": "Saavedra",
"creatorType": "author"
}
],
"date": "2022/03",
"DOI": "10.1257/jel.20201641",
"ISSN": "0022-0515",
"abstractNote": "This article reviews the global health and economic consequences of the 1918 influenza pandemic, with a particular focus on topics that have seen a renewed interest because of COVID-19. We begin by providing an overview of key contextual and epidemiological details as well as the data that are available to researchers. We then examine the effects on mortality, fertility, and the economy in the short and medium run. The role of non-pharmaceutical interventions in shaping those outcomes is discussed throughout. We then examine longer-lasting health consequences and their impact on human capital accumulation and socioeconomic status. Throughout the paper we highlight important areas for future work.",
"issue": "1",
"language": "en",
"libraryCatalog": "www.aeaweb.org",
"pages": "41-84",
"publicationTitle": "Journal of Economic Literature",
"url": "https://www.aeaweb.org/articles?id=10.1257/jel.20201641",
"volume": "60",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Aggregate Human Capital"
},
{
"tag": "Aggregate Labor Productivity, Business Fluctuations"
},
{
"tag": "Business Fluctuations; Cycles"
},
{
"tag": "Child Care"
},
{
"tag": "Children"
},
{
"tag": "Cycles, Health Behavior, Health and Economic Development, Fertility"
},
{
"tag": "Economic History: Labor and Consumers, Demography, Education, Health, Welfare, Income, Wealth, Religion, and Philanthropy: General, International, or Comparative"
},
{
"tag": "Employment"
},
{
"tag": "Employment; Unemployment; Wages; Intergenerational Income Distribution; Aggregate Human Capital; Aggregate Labor Productivity"
},
{
"tag": "Family Planning"
},
{
"tag": "Fertility; Family Planning; Child Care; Children; Youth"
},
{
"tag": "Health Behavior"
},
{
"tag": "Health and Economic Development"
},
{
"tag": "Human Capital; Skills; Occupational Choice; Labor Productivity"
},
{
"tag": "Intergenerational Income Distribution"
},
{
"tag": "Labor Productivity, Economic History: Labor and Consumers, Demography, Education, Health, Welfare, Income, Wealth, Religion, and Philanthropy: General, International, or Comparative"
},
{
"tag": "Occupational Choice"
},
{
"tag": "Skills"
},
{
"tag": "Unemployment"
},
{
"tag": "Wages"
},
{
"tag": "Youth, Human Capital"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

311
AGRIS.js Normal file
View File

@ -0,0 +1,311 @@
{
"translatorID": "48a67d12-1bcf-44ac-a4f4-11457ebfc0bb",
"label": "AGRIS",
"creator": "Abe Jellinek",
"target": "^https?://agris\\.fao\\.org/agris-search/search",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-12 21:34:16"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('.docType_ico img[title*="Dataset"]')) {
return "document";
}
else if (doc.querySelector('meta[name="citation_journal_title"]')) {
return "journalArticle";
}
else if (doc.querySelector('meta[name="citation_title"]')) {
return "report";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h3 > a[href*="search.do"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
// item.url will be empty if there's no full-text link; we don't want
// to use the catalog page as the URL in that case.
item.url = attr(doc, '.link-full-text a', 'href');
item.attachments = [];
if (item.itemType == 'document') {
item.extra = (item.extra || '') + '\nType: dataset';
}
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = detectWeb(doc, url);
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://agris.fao.org/agris-search/search.do?recordID=IR2012044101",
"items": [
{
"itemType": "report",
"title": "Possibility of artificial propagation in farmed great sturgeon (Huso huso)",
"creators": [
{
"firstName": "Mahmoud",
"lastName": "Bahmani",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Porkazemi",
"creatorType": "author"
},
{
"firstName": "H.",
"lastName": "Khara",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Rahimidanesh",
"creatorType": "author"
},
{
"firstName": "M. A.",
"lastName": "Tolooei",
"creatorType": "author"
},
{
"firstName": "A.",
"lastName": "Abasalizadeh",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Hassanzadehsaber",
"creatorType": "author"
},
{
"firstName": "H.",
"lastName": "Mohamadiparashkohi",
"creatorType": "author"
},
{
"firstName": "O.",
"lastName": "Asghari",
"creatorType": "author"
},
{
"firstName": "R.",
"lastName": "Kazemi",
"creatorType": "author"
},
{
"firstName": "S.",
"lastName": "Dezhandian",
"creatorType": "author"
},
{
"firstName": "A.",
"lastName": "Yousefi Jourdehi",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Mohseni",
"creatorType": "author"
},
{
"firstName": "M. A.",
"lastName": "Yazdani",
"creatorType": "author"
},
{
"firstName": "A.",
"lastName": "Hallajian",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Shakourian",
"creatorType": "author"
},
{
"firstName": "M.",
"lastName": "Pourdehghani",
"creatorType": "author"
}
],
"date": "2011",
"abstractNote": "In this research, morphometrical and physiological indicators of farmed great sturgeon, Huso huso in the Dr.Dadman International Sturgeon Research Institute studied. After biopsy of male and female gonads, two groups in terms of sexual maturity stage were observed. According to the histological observations, gonad development of male fish in the test group 1, stage II to III and in the test group 2 stage II to IV and in female fish in the test group 1 from stage II to stage II-III and in the test group 2 in stage III of sexual development and maturity stage was determined Maximum average weight and total length in a group of male fish in the summer (39/07±5/79 kg and 170 ± 6/48cm) and minimum average weight and total length in the two test groups of male fish in the autumn (26/25±3/65 kg and 155/5±4/40 cm) were measured. In the female test groups, the maximum average of weight and total length of the test group 2 in the summer (40/32±3/09 kg 170/12±1/96 cm), and the minimum of the test group 1 in the fall (25/8±1/30 kg and 160/6± 1/97 cm) were determined. The results of measuring the cortisol hormone in male test group, maximum and minimum average in the test group 1, respectively, in the summer (41/25±6/34 ng/ml) and fall (24/62±13/96 ng/ml) showed a significant difference between groups (p0.05). While the results of female group tests in test groups in relation with cortisol hormone had suggested that the maximum in group 2 in winter (58±25/92 ng/ml) and minimum in group 1 in the autumn (9/32±5/6 ng/ml) were observed and there were significant difference between groups (p0.05). Male, the results had suggested that the maximum average testosterone in the test group 2 in winter (71/25±15/52 ng / ml) and minimum in group 1 and in winter (27±6/60 ng/ml), respectively. So that showed significant difference between groups (P0.05). progesterone hormone were in the test group 2 and in summer (1/52±0/18 ng/ml) and its minimum in winter (0/14± 0/10 ng/ml) in test group 1 (p0.05), respectively. Maximum hormone levels 17-beta estradiol in the test group 2 in the autumn (16/42±6/36 ng/ml) and its minimum in the test group 1 in the winter (3/1±0/74 ng/ml) was observed and showed no statistical difference between groups (p 0.05). Based on the results, levels of female sex hormones in the test group showed that maximum testosterone (19/87±10/72 ng/ml) in the test group 2 in summer and minimum16/0±0/02 ng/ml) in the test group 1, were determined and had significant difference in all seasons (p0.05 (0/03±0/01 ng/ml) in the test group 1 was observed in winter that a significant difference between groups showed at fall (P0.05). Maximum and minimum levels of the hormone 17-beta estradiol in the test group 2 was observed in autumn (12/37±7/23 ng/ml), respectively (p0.05). The results of plasma metabolites (glucose, cholesterol, triglycerides and total lipid in the male test groups had suggested that the maximum and minimum of glucose in the test group 1 was (75/25±8/71 mg/dl) in winter and (39/5±6/71 mg / dl) summer, respectively. Maximum and minimum levels of cholesterol in group 1 was observed in autumn (128/75±54/34 mg/dl) and in winter (74/5±8/19 mg/dl), respectively. Maximum and minimum amount of triglycerides in the test group 2 observed in winter (384/75±50/93 mg/dl) and (156/25±16/34 mg / dl) in spring, so that in the spring between the groups showed significant difference (p0.05). Maximum total lipid in the test group 2 was observed in summer (686/25 ± 83/27 mg/dl) and minimum in the test group 1 in spring (410±62/03 mg/dl). Maximum and minimum glucose levels in a female group was observed in winter (82/7±11/55 mg/dl) and autumn (27/6±6 /41 mg/dl), respectively. The maximum cholesterol amount of the test group 1 was observed in winter (87±3/66 mg/dl) and minimum in the test group 2 in autumn (63/5±5/23 mg/dl). Maximum and minimum amount of triglycerides in the test group 2 was in the spring (281±33/67 mg/dl) and its minimum in autumn (213/75 ± 32/44 mg/dl), respectively, so that in the spring showed significant difference between the groups (p0.05).Maximum total lipid amount was in the test group 2 in spring (554/7±31/59 mg/dl) and minimum in the test group 1 in winter (367±21/22 mg/dl) and in summer between groups significant difference was observed (p0.05). The results of calcium and sodium cations and osmolarity in males suggested that calcium in females and sodium in males showed significant difference related to sexual maturation stage (P0.05). But osmolarity didn t show significant difference in both sex (p0.05).",
"institution": "Iranian Fisheries Research Organization",
"language": "Farsi",
"libraryCatalog": "agris.fao.org",
"url": "https://agris.fao.org/agris-search/search.do?recordID=IR2012044101",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://agris.fao.org/agris-search/search.do?recordID=TH2005000236",
"items": [
{
"itemType": "journalArticle",
"title": "Efficiency of antimicrobial residue screening test kit for meat CM-Test",
"creators": [
{
"firstName": "Thongchai",
"lastName": "Chalermchaikit",
"creatorType": "author"
},
{
"firstName": "Kriengsak",
"lastName": "Poonsook",
"creatorType": "author"
},
{
"firstName": "Kriengsuk",
"lastName": "Dangprom",
"creatorType": "author"
},
{
"firstName": "Monthon",
"lastName": "Lertworapreecha",
"creatorType": "author"
},
{
"firstName": "Kittikorn",
"lastName": "Jotisakulratana",
"creatorType": "author"
}
],
"date": "2002",
"ISSN": "0125-0369",
"abstractNote": "Concerns of antimicrobial residues in food of animal origins are not only the adverse health effect to consumers but also the impact on exportation. The conventional methods for detecting antimicrobial residues in meat are European Four Pate Test (EDPR) method which use Bacillus subtilis and Micrococcus luteus in Test agar or Microbial Inhibition Disk Assay (MIDA) which use Bacillus mycoides, Bacillus subtilis and Micrococcus luteus in Antibiotic medium as indicators. However, EFPT and MIDA are required incubating time at least 18 hours for reading the results. Besides, EFPT and MIDA have been showed low specificity, which lead to false negative results. Therefore, antimicrobial screening test kit for meat has been developed by the full support from Thai Research Fund (TRF). The concept of new developed antimicrobial screening test kit (CM-Test) is tube diffusion method. There are consisted of Bacillus stearothermophilus in appropriated medium, which contained in polypropylene tube (1*4 cm). The tested results can be read after the meat extract supernatant of 0.1 ml is put into the test kit and incubated at 65+-1 deg C for 3 1/2-4 1/2 hours. The color of test kit will not be changed if the sample is positive (contain antimicrobial residue). If the sample is negative, test kit color will be changed to yellow. The prevalence of antimicrobial residues in 300 chicken meat samples and 300 pork samples, randomly purchased from markets and supermarkets in Bangkok during July 2001 to February 2002, had been studied. The results of chicken meat samples were found positive 12.3, 0 and 1.7 percent by using CM-Test, EFPT and MIDA methods, respectively. The results of pork samples were found positive 8.3, 2 and 2.7 percent by using CM-Test, EFPT and MIDA methods, respectively. Positive samples were confirmed by Charm II Test method. These results reveal that the detection limits developed antimicrobial residue screening test kit are better than conventional methods, EFPT and MIDA.",
"language": "Thai",
"libraryCatalog": "agris.fao.org",
"publicationTitle": "Warasan Witthayasat Kaset",
"url": "https://agris.fao.org/agris-search/search.do?recordID=TH2005000236",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://agris.fao.org/agris-search/search.do?request_locale=ar&recordID=AV20120164931&query=&sourceQuery=&sortField=&sortOrder=&countryResource=&agrovocString=&advQuery=&centerString=&enableField=",
"items": [
{
"itemType": "report",
"title": "Petroleum Hydrocarbons in Saudi Red Sea Coastal Waters الهيدروكربونات البترولية في المياه السطحية لساحل البحر الاحمر السعودية (منطقة بترومين)",
"creators": [
{
"firstName": "Sultan",
"lastName": "Al-Lihaibi",
"creatorType": "author"
},
{
"firstName": "Turki",
"lastName": "Al-Ghamdy",
"creatorType": "author"
}
],
"date": "1997",
"abstractNote": "Total petroleum hydrocarbons in surface water samples collected from the Red Sea coast al area of Jeddah (Saudi Arabia), have been measured using ultraviolet fluorescence spectroscopy (UVF). Concentration level ranged between 1.79 and 17.9 J..I.g 1,1 light Arabian oil equivalents . Samples taken near the oil terminal (Petromin) showed relatively high concentrations (2.8-17.9 J..I.g I\" 1). whereas in the relatively clean Obhur Creek concentrations wer~ low (2 J..I.g 1- I). Perfect agreement has been obtained between concentrations calculated as chrysene and light Arabian equivalents. However, the light Arabian equivalent concentration is almost 6 times the chrysene equivalent concentration . تم قياس الهيدروكربونات البترولية في المياه السطحية للمنطقة الساحلية لمدينة جدة باستخدام مطياف الفلورة فوق البنفسجية . وجد أن مستوى التركيز في العينات تراوح بين 1.8 و 17.9 مايكروجرام / لتر وحدات زيت عربي خفيف مكافئة . وقد لوحظ أن العينات القريبة من مصرف مصفاة الزيت (بترومين) أعطت تراكيز عالية ( 2.8-17.9 مايكروجرام/ لتر ) بينما أعطت العينات المأخوذة من شرم أبحر ، والذي يعتبر الأنظف نسبيا ، قراءات منخفضة ( 2.0 مايكروجرام / لتر أو أقل ) . كما لوحظ وجود علاقة بين التركيزات المحسوبة على أساس وحدات كرايسين مكافئة وتلك المحسوبة على أساس وحدات زيت عربي خفيف مكافئة بحيث يكون الأخير مساويا لما يقارب 6 أضعاف الأول.",
"institution": "KAU - Scientific Publishing Center",
"language": "English",
"libraryCatalog": "agris.fao.org",
"url": "http://www.kau.edu.sa/centers/spc/jkau/Doc/Mar/8/Petroleum%20Hydrocarbons%20in%20Saudi%20Red%20Sea%20Coastal%20Waters.pdf",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://agris.fao.org/agris-search/searchIndex.do?query=soil+water",
"items": "multiple"
}
]
/** END TEST CASES **/

313
AMS MathSciNet (Legacy).js Normal file
View File

@ -0,0 +1,313 @@
{
"translatorID": "a354331-981b-43de-a61-bc26dd1be3a9",
"label": "AMS MathSciNet (Legacy)",
"creator": "Simon Kornblith, Sebastian Karcher",
"target": "^https?://(mathscinet\\.)?ams\\.[^/]*/(mathscinet/2006/)?mathscinet(\\-getitem\\?|/search/(publications\\.html|publdoc\\.html))",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-07-06 17:03:34"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2015-2023 Simon Kornblith & Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
var itemType;
if (getSearchResults(doc, true)) {
return "multiple";
}
else if (ZU.xpathText(doc, '//div[@class="headlineMenu"]/*[last()-1]')) {
itemType = ZU.xpathText(doc, '//div[@class="headlineMenu"]/*[last()-1]');
switch (itemType.trim().toLowerCase()) {
case 'article':
return "journalArticle";
case 'book':
return "book";
case 'chapter':
return "bookSection";
}
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//div[@class="headlineText"]');
for (var i = 0; i < rows.length; i++) {
var href = ZU.xpathText(rows[i], './a[@class="mrnum"]/@href');
var title = ZU.xpathText(rows[i], './span[@class="title"]');
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
async function doWeb(doc, url) {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url));
}
}
else {
await scrape(doc, url);
}
}
async function scrape(doc, url = doc.location.href) {
var host = url.match(/^(.+)\/mathscinet/);
var pub = host[0] + "/search/publications.html?fmt=bibtex";
var MR = ZU.xpathText(doc, '//div[@id="content"]/div[@class="doc"]/div[@class="headline"]/strong[1]');
pub += "&pg1=MR&s1=" + MR.replace(/^MR0*/, "");
let text = await requestText(pub);
var preRE = /<pre>\s*([\s\S]*?)\s*<\/pre>/g;
var bibTeXString = "";
var m;
//eslint-disable-next-line no-cond-assign
while (m = preRE.exec(text)) {
bibTeXString += m[1] + '\n';
}
// import using BibTeX
let translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(bibTeXString);
translator.setHandler("itemDone", function (obj, item) {
// Fix/fetch MR number
var mrnumber;
if (item.extra) {
item.extra = item.extra.replace(/^MR:\s*(?:MR)?(\d+).*/gm,
function (m, mr) {
mrnumber = mr;
return 'MR: ' + mr;
});
}
if (mrnumber) {
url = 'https://mathscinet.ams.org/mathscinet-getitem?mr=' + mrnumber;
}
item.attachments.push({ title: "MathSciNet Snapshot", document: doc });
item.url = url;
item.complete();
});
await translator.translate();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg4=AUCN&s4=Karcher&co4=AND&pg5=TI&s5=&co5=AND&pg6=PC&s6=&co6=AND&pg7=ALLF&s7=&co7=AND&Submit=Search&dr=all&yrop=eq&arg3=&yearRangeFirst=&yearRangeSecond=&pg8=ET&s8=All&review_format=html",
"items": "multiple"
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=3004573",
"items": [
{
"itemType": "journalArticle",
"title": "Extrapolation of stable random fields",
"creators": [
{
"firstName": "Wolfgang",
"lastName": "Karcher",
"creatorType": "author"
},
{
"firstName": "Elena",
"lastName": "Shmileva",
"creatorType": "author"
},
{
"firstName": "Evgeny",
"lastName": "Spodarev",
"creatorType": "author"
}
],
"date": "2013",
"DOI": "10.1016/j.jmva.2012.11.004",
"ISSN": "0047-259X",
"extra": "MR: 3004573",
"itemID": "MR3004573",
"journalAbbreviation": "J. Multivariate Anal.",
"libraryCatalog": "AMS MathSciNet (Legacy)",
"pages": "516536",
"publicationTitle": "Journal of Multivariate Analysis",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=3004573",
"volume": "115",
"attachments": [
{
"title": "MathSciNet Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg1=ISSI&s1=308850",
"items": "multiple"
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=2767535",
"items": [
{
"itemType": "bookSection",
"title": "On implementation of the Markov chain Monte Carlo stochastic approximation algorithm",
"creators": [
{
"firstName": "Yihua",
"lastName": "Jiang",
"creatorType": "author"
},
{
"firstName": "Peter",
"lastName": "Karcher",
"creatorType": "author"
},
{
"firstName": "Yuedong",
"lastName": "Wang",
"creatorType": "author"
}
],
"date": "2011",
"bookTitle": "Advances in directional and linear statistics",
"extra": "MR: 2767535\nDOI: 10.1007/978-3-7908-2628-9_7",
"itemID": "MR2767535",
"libraryCatalog": "AMS MathSciNet (Legacy)",
"pages": "97111",
"publisher": "Physica-Verlag/Springer, Heidelberg",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2767535",
"attachments": [
{
"title": "MathSciNet Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/2006/mathscinet/search/publdoc.html?arg3=&co4=AND&co5=AND&co6=AND&co7=AND&dr=all&pg4=MR&pg5=TI&pg6=PC&pg7=ALLF&pg8=ET&r=1&review_format=html&s4=2663710",
"items": [
{
"itemType": "book",
"title": "Advances in directional and linear statistics",
"creators": [
{
"firstName": "Martin T.",
"lastName": "Wells",
"creatorType": "editor"
},
{
"firstName": "Ashis",
"lastName": "SenGupta",
"creatorType": "editor"
}
],
"date": "2011",
"ISBN": "9783790826272",
"extra": "MR: 2663710\nDOI: 10.1007/978-3-7908-2628-9",
"itemID": "MR2663710",
"libraryCatalog": "AMS MathSciNet (Legacy)",
"numPages": "xiv+321",
"publisher": "Physica-Verlag/Springer, Heidelberg",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2663710",
"attachments": [
{
"title": "MathSciNet Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [
{
"note": "<p>A Festschrift for Sreenivasa Rao Jammalamadaka</p>"
}
],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201",
"items": [
{
"itemType": "journalArticle",
"title": "Sommation des séries divergentes",
"creators": [
{
"firstName": "Bernard",
"lastName": "Malgrange",
"creatorType": "author"
}
],
"date": "1995",
"ISSN": "0723-0869",
"extra": "MR: 1346201",
"issue": "2-3",
"itemID": "MR1346201",
"journalAbbreviation": "Exposition. Math.",
"libraryCatalog": "AMS MathSciNet",
"pages": "163222",
"publicationTitle": "Expositiones Mathematicae. International Journal",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201",
"volume": "13",
"attachments": [
{
"title": "MathSciNet Snapshot"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -1,45 +1,61 @@
{
"translatorID": "a354331-981b-43de-a61-bc26dd1be3a9",
"translatorID": "16f2936d-a059-40e8-a48e-f0acbb1e93e0",
"label": "AMS MathSciNet",
"creator": "Simon Kornblith",
"target": "^https?://(mathscinet\\.)?ams\\.[^/]*/mathscinet(\\-getitem\\?|/search/(publications\\.html|publdoc\\.html))",
"creator": "Sebastian Karcher",
"target": "^https?://mathscinet\\.ams\\.[^/]*/mathscinet/(article\\?|publications-search\\?|author\\?)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-10-20 16:08:00"
"lastUpdated": "2023-07-14 11:04:37"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2023 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
var itemType;
if (getSearchResults(doc, true)) {
return "multiple"
} else if (itemType = ZU.xpathText(doc, '//div[@class="headlineMenu"]/*[last()-1]')) {
switch (itemType.trim().toLowerCase()) {
case 'article':
return "journalArticle";
case 'book':
return "book";
case 'chapter':
return "bookSection";
}
return "multiple";
}
else if (url.includes("article?mr=")) {
if (doc.querySelector('div[data-testid="ap-book-isbn"]')) {
if (doc.querySelector('div[data-testid="ap-book-collection"] a.router-link-active')) return "bookSection";
else return "book";
}
else return "journalArticle";
}
else return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
//TODO: adjust the xpath
var rows = ZU.xpath(doc, '//div[@class="headlineText"]');
for (var i=0; i<rows.length; i++) {
//TODO: check and maybe adjust
var href = ZU.xpathText(rows[i], './a[@class="mrnum"]/@href')
//TODO: check and maybe adjust
var title = ZU.xpathText(rows[i], './span[@class="title"]')
var rows = doc.querySelectorAll('.results div.font-weight-bold');
for (let row of rows) {
let href = attr(row, 'a', 'href');
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
@ -48,74 +64,51 @@ function getSearchResults(doc, checkOnly) {
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
});
} else {
scrape(doc, url);
async function doWeb(doc, url) {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url));
}
}
else {
await scrape(doc, url);
}
}
function scrape(doc, url) {
var host = url.match(/^(.+)\/mathscinet/)
var pub = host[0] + "/search/publications.html?fmt=bibtex";
var MR = ZU.xpathText(doc, '//div[@id="content"]/div[@class="doc"]/div[@class="headline"]/strong[1]');
pub += "&pg1=MR&s1="+MR.replace(/^MR0*/, "");
ZU.doGet(pub, function(text) {
var preRE = /<pre>\s*([\s\S]*?)\s*<\/pre>/g;
var bibTeXString = "";
var m;
while (m = preRE.exec(text)) {
bibTeXString += m[1] + '\n';
}
// import using BibTeX
var translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(bibTeXString);
translator.setHandler("itemDone", function(obj, item) {
// Fix/fetch MR number
var mrnumber;
if (item.extra) {
item.extra = item.extra.replace(/^MR:\s*(?:MR)?(\d+).*/gm,
function(m, mr) {
mrnumber = mr;
return 'MR: ' + mr;
});
}
if (mrnumber) {
url = 'https://mathscinet.ams.org/mathscinet-getitem?mr=' + mrnumber;
}
item.attachments.push({title: "MathSciNet Snapshot", document: doc});
item.url = url;
item.complete();
async function scrape(doc, url = doc.location.href) {
let id = url.match(/\?mr=(\d+)/);
if (!id) {
throw new Error("No MR ID, can't proceed");
}
let bibJSONUrl = '/mathscinet/api/publications/format?formats=bib&ids=' + id[1];
// Z.debug(bibJSONUrl)
let bibJSON = await requestText(bibJSONUrl);
// Z.debug(bibJSON)
bibJSON = JSON.parse(bibJSON);
let bibTex = bibJSON[0].bib;
// Z.debug(bibTex)
let translator = Zotero.loadTranslator("import");
translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4');
translator.setString(bibTex);
translator.setHandler('itemDone', (_obj, item) => {
item.url = ""; // these aren't full text URLs
item.attachments.push({
title: 'Snapshot',
document: doc
});
translator.translate();
item.complete();
});
await translator.translate();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg4=AUCN&s4=Karcher&co4=AND&pg5=TI&s5=&co5=AND&pg6=PC&s6=&co6=AND&pg7=ALLF&s7=&co7=AND&Submit=Search&dr=all&yrop=eq&arg3=&yearRangeFirst=&yearRangeSecond=&pg8=ET&s8=All&review_format=html",
"items": "multiple"
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=3004573",
"url": "https://mathscinet.ams.org/mathscinet/article?mr=3004573",
"items": [
{
"itemType": "journalArticle",
@ -139,18 +132,18 @@ var testCases = [
],
"date": "2013",
"DOI": "10.1016/j.jmva.2012.11.004",
"ISSN": "0047-259X",
"ISSN": "0047-259X,1095-7243",
"extra": "MR: 3004573",
"itemID": "MR3004573",
"journalAbbreviation": "J. Multivariate Anal.",
"libraryCatalog": "AMS MathSciNet",
"pages": "516536",
"publicationTitle": "Journal of Multivariate Analysis",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=3004573",
"volume": "115",
"attachments": [
{
"title": "MathSciNet Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -161,12 +154,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/search/publications.html?pg1=ISSI&s1=308850",
"items": "multiple"
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2767535",
"url": "https://mathscinet.ams.org/mathscinet/article?mr=2767535",
"items": [
{
"itemType": "bookSection",
@ -189,16 +177,17 @@ var testCases = [
}
],
"date": "2011",
"ISBN": "9783790826272",
"bookTitle": "Advances in directional and linear statistics",
"extra": "MR: 2767535\nDOI: 10.1007/978-3-7908-2628-9_7",
"itemID": "MR2767535",
"libraryCatalog": "AMS MathSciNet",
"pages": "97111",
"publisher": "Physica-Verlag/Springer, Heidelberg",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2767535",
"attachments": [
{
"title": "MathSciNet Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -206,10 +195,10 @@ var testCases = [
"seeAlso": []
}
]
},
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2663710",
"url": "https://mathscinet.ams.org/mathscinet/article?mr=2663710",
"items": [
{
"itemType": "book",
@ -233,10 +222,10 @@ var testCases = [
"libraryCatalog": "AMS MathSciNet",
"numPages": "xiv+321",
"publisher": "Physica-Verlag/Springer, Heidelberg",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=2663710",
"attachments": [
{
"title": "MathSciNet Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -251,7 +240,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201",
"url": "https://mathscinet.ams.org/mathscinet/article?mr=1346201",
"items": [
{
"itemType": "journalArticle",
@ -272,11 +261,11 @@ var testCases = [
"libraryCatalog": "AMS MathSciNet",
"pages": "163222",
"publicationTitle": "Expositiones Mathematicae. International Journal",
"url": "https://mathscinet.ams.org/mathscinet-getitem?mr=1346201",
"volume": "13",
"attachments": [
{
"title": "MathSciNet Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -284,6 +273,16 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/publications-search?query=karcher&page=1&size=20&sort=newest&facets=",
"items": "multiple"
},
{
"type": "web",
"url": "https://mathscinet.ams.org/mathscinet/author?authorId=98350",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -1,21 +1,21 @@
{
"translatorID": "1e1e35be-6264-45a0-ad2e-7212040eb984",
"label": "APA PsycNET",
"label": "APA PsycNet",
"creator": "Philipp Zumstein",
"target": "^https?://psycnet\\.apa\\.org/",
"target": "^https?://(psycnet|doi)\\.apa\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-09-21 07:34:07"
"lastUpdated": "2025-03-10 19:48:42"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2017 Philipp Zumstein
Copyright © 2017-2021 Philipp Zumstein
This file is part of Zotero.
@ -46,35 +46,18 @@
// to avoid some automatic download detection.
// attr()/text() v2
// eslint-disable-next-line
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
function detectWeb(doc, url) {
// the dection will only work if the page is load completely,
// thus we have to hardcode some test cases
if (url.includes('://psycnet.apa.org/record/1992-98221-010')) return "bookSection";
if (url.includes('://psycnet.apa.org/record/2004-16329-000')) return "book";
if (url.includes('://psycnet.apa.org/buy/2004-16329-002')) return "bookSection";
if (url.includes('://psycnet.apa.org/buy/2010-19350-001')) return "journalArticle";
if (url.includes('://psycnet.apa.org/record/2010-09295-002')) return "bookSection";
// normal cases
// It seems that the url sometimes changes after Zotero has inspected it,
// which leads to the wrong Zotero icon. However, saving will still do the
// correct action. Reload the page might also solve some edge cases.
if (url.includes('/PsycBOOKS/')) {
return "book";
}
if (url.includes('/search/display?')
|| url.includes('/record/')
|| url.includes('/fulltext/')
|| url.includes('/buy/')
|| url.includes('/doiLanding?doi=')) {
if (doc.getElementById('bookchapterstoc')) {
if (attr(doc, 'meta[name="og:type"]', 'content') == 'Chapter') {
return "bookSection";
}
else if (doc.getElementById('bookchapterstoc')) {
return "book";
}
else {
return "journalArticle";
}
@ -91,7 +74,7 @@ function getSearchResults(doc, checkOnly) {
var found = false;
var rows = doc.querySelectorAll('a.article-title');
for (var i = 0; i < rows.length; i++) {
var href = attr(rows[i].parentNode, '#buy, a.fullTextHTMLLink, a.fullTextLink', 'href');
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
if (checkOnly) return true;
@ -102,45 +85,42 @@ function getSearchResults(doc, checkOnly) {
}
function doWeb(doc, url) {
async function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
});
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) {
return;
}
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url), url);
}
}
else {
scrape(doc, url);
await scrape(doc, url);
}
}
function scrape(doc, url) {
var uid = getIds(doc, url.replace(/[?#].*$/, ''));
async function scrape(doc, url) {
var uid = await getIds(doc, url.replace(/#.*$/, ''));
if (!uid) {
throw new Error("ID not found");
}
var productCode;
var db = doc.getElementById('database');
var db = doc.getElementById('database') || doc.querySelector('doi-landing .meta span');
if (db) {
db = db.parentNode.textContent;
if (db.includes('PsycARTICLES')) {
db = db.parentNode.textContent.toLowerCase();
if (db.includes('psycarticles')) {
productCode = 'PA';
}
else if (db.includes('PsycBOOKS')) {
else if (db.includes('psycbooks')) {
productCode = 'PB';
}
else if (db.includes('PsycINFO')) {
else if (db.includes('psycinfo')) {
productCode = 'PI';
}
else if (db.includes('PsycEXTRA')) {
else if (db.includes('psycextra')) {
productCode = 'PE';
}
}
@ -149,44 +129,70 @@ function scrape(doc, url) {
productCode = 'PI';
}
var postData = '{"api":"record.exportRISFile","params":{"UIDList":[{"UID":"' + uid + '","ProductCode":"' + productCode + '"}],"exportType":"zotero"}}';
var postData = JSON.stringify({
api: "record.exportRISFile",
params: {
UIDList: [{ UID: uid, ProductCode: productCode }],
exportType: "zotero"
}
});
var headers = {
'Content-Type': 'application/json',
Referer: url
};
// 1. We have to set the uid, product code and format with a post request
ZU.doPost('/api/request/record.exportRISFile', postData, function (apiReturnMessage) {
var apiReturnData;
try {
apiReturnData = JSON.parse(apiReturnMessage);
let apiReturnData = await requestJSON('/api/request/record.exportRISFile', {
method: 'POST',
headers: headers,
body: postData,
});
if (apiReturnData && apiReturnData.isRisExportCreated) {
// 2. Download the requested data (after step 1)
let data = await requestText('/ris/download');
if (data.includes('Content: application/x-research-info-systems')) {
await processRIS(data, doc);
}
catch (e) {
Z.debug('POST request did not result in valid JSON');
Z.debug(apiReturnMessage);
else {
// sometimes (e.g. during testing) the data is not loaded
// but a meta redirect to a captcha page mentioning
Z.debug("The APA anomaly detection think we are doing "
+ "something unusual (sigh). Please reload any APA page e.g. "
+ "http://psycnet.apa.org/ in your browser and try again.");
Z.debug(data);
}
if (apiReturnData && apiReturnData.isRisExportCreated) {
// 2. Download the requested data (after step 1)
ZU.doGet('/ris/download', function (data) {
if (data.includes('Content: application/x-research-info-systems')) {
processRIS(data, doc);
}
else {
// sometimes (e.g. during testing) the data is not loaded
// but a meta redirect to a captcha page mentioning
Z.debug("The APA anomaly detection think we are doing "
+ "something unusual (sigh). Please reload any APA page e.g. "
+ "http://psycnet.apa.org/ in your browser and try again.");
Z.debug(data);
}
});
}
}, headers);
}
}
function processRIS(text, doc) {
async function processRIS(text, doc) {
let pdfURL = attr(doc, 'a[href*="/fulltext"]', 'href');
if (!pdfURL) {
Zotero.debug('Fetching institution ID for PDF');
try {
let uid = doc.location.pathname.match(/\/(?:record|fulltext)\/([^/.]+)/)[1];
let { institution } = await requestJSON(
'https://psycnet.apa.org/api/request/institution.getInstitutionByIpAddress', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
api: 'institution.getInstitutionByIpAddress',
params: { uid }
})
}
);
if (institution) {
pdfURL = `https://psycnet.apa.org/fulltext/${uid}.pdf?auth_id=${institution.ringGoldId}&returnUrl=${encodeURIComponent(doc.location.href)}`;
}
}
catch (e) {
Zotero.debug('Failed to fetch institution ID');
Zotero.debug(e);
}
}
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
@ -196,10 +202,13 @@ function processRIS(text, doc) {
if (item.bookTitle) item.bookTitle = cleanTitle(item.bookTitle);
if (item.series) item.series = cleanTitle(item.series);
if (item.place) item.place = item.place.replace(/\s+/g, ' ');
if (item.ISSN) item.ISSN = ZU.cleanISSN(item.ISSN);
if (item.pages && item.pages.includes('No Pagination Specified')) {
delete item.pages;
}
for (var i = 0; i < item.tags.length; i++) {
item.tags[i] = item.tags[i].replace(/^\*/, '');
}
var pdfURL = attr(doc, 'a[href*="/fulltext"]', 'href');
if (pdfURL) {
item.attachments.push({
url: pdfURL,
@ -207,18 +216,21 @@ function processRIS(text, doc) {
mimeType: "application/pdf"
});
}
item.attachments.push({
title: "Snapshot",
document: doc
});
else {
item.attachments.push({
title: "Snapshot",
document: doc
});
}
item.complete();
});
translator.translate();
await translator.translate();
}
// try to figure out ids that we can use for fetching RIS
function getIds(doc, url) {
async function getIds(doc, url) {
Z.debug('Finding IDs in ' + url);
// try to extract uid from the table
var uid = text(doc, '#uid + dd') || text(doc, '#bookUID');
if (uid) {
@ -226,8 +238,16 @@ function getIds(doc, url) {
}
// try to extract uid from the url
if (url.includes('/record/')) {
let m = url.match(/\/record\/([\d-]*)/);
if (url.includes('/record/') || url.includes('/fulltext/')) {
let m = url.match(/\/(?:record|fulltext)\/([\d-]*)/);
if (m && m[1]) {
return m[1];
}
}
// DOI landing pages include a link to the /record/ page
if (url.includes('/doiLanding') && doc.querySelector('.title > a')) {
let m = attr(doc, '.title > a', 'href').match(/\/record\/([\d-]*)/);
if (m && m[1]) {
return m[1];
}
@ -262,13 +282,48 @@ function getIds(doc, url) {
}
}
/** last option: check for a purchase link
/** check for a purchase link
*/
var purchaseLink = attr(doc, 'a.purchase[href*="/buy/"]', 'href');
if (purchaseLink) {
let m = purchaseLink.match(/\/buy\/([\d-]*)/);
return m[1];
}
// Worst-case fallback if we're on a search result page: make some requests
if (url.includes('/search/display?')) {
let searchParams = new URL(url).searchParams;
let id = searchParams.get('id');
if (id) {
let searchObj = await requestJSON('/api/request/recentSearch.get', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api: 'recentSearch.get',
params: {
id
}
})
});
let recordId = parseInt(searchParams.get('recordId'));
let recordWithCount = await requestJSON('/api/request/search.recordWithCount', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
api: 'search.recordWithCount',
params: {
...searchObj,
responseParameters: {
...searchObj.responseParameters,
start: recordId - 1,
rows: 1
}
}
})
});
return recordWithCount.results.result.doc[0].UID;
}
}
return false;
}
@ -289,7 +344,7 @@ function cleanTitle(title) {
var testCases = [
{
"type": "web",
"url": "http://psycnet.apa.org/record/2004-16644-010",
"url": "https://psycnet.apa.org/record/2004-16644-010",
"items": [
{
"itemType": "journalArticle",
@ -313,17 +368,18 @@ var testCases = [
],
"date": "2004",
"DOI": "10.1037/0894-4105.18.3.485",
"ISSN": "1931-1559(Electronic),0894-4105(Print)",
"abstractNote": "A comprehensive, empirically based review of the published studies addressing neuropsychological performance in adults diagnosed with attention-deficit/hyperactivity disorder (ADHD) was conducted to identify patterns of performance deficits. Findings from 33 published studies were submitted to a meta-analytic procedure producing sample-size-weighted mean effect sizes across test measures. Results suggest that neuropsychological deficits are expressed in adults with ADHD across multiple domains of functioning, with notable impairments in attention, behavioral inhibition, and memory, whereas normal performance is noted in simple reaction time. Theoretical and developmental considerations are discussed, including the role of behavioral inhibition and working memory impairment. Future directions for research based on these findings are highlighted, including further exploration of specific impairments and an emphasis on particular tests and testing conditions. (PsycINFO Database Record (c) 2016 APA, all rights reserved)",
"ISSN": "1931-1559",
"abstractNote": "A comprehensive, empirically based review of the published studies addressing neuropsychological performance in adults diagnosed with attention-deficit/hyperactivity disorder (ADHD) was conducted to identify patterns of performance deficits. Findings from 33 published studies were submitted to a meta-analytic procedure producing sample-size-weighted mean effect sizes across test measures. Results suggest that neuropsychological deficits are expressed in adults with ADHD across multiple domains of functioning, with notable impairments in attention, behavioral inhibition, and memory, whereas normal performance is noted in simple reaction time. Theoretical and developmental considerations are discussed, including the role of behavioral inhibition and working memory impairment. Future directions for research based on these findings are highlighted, including further exploration of specific impairments and an emphasis on particular tests and testing conditions. (PsycInfo Database Record (c) 2022 APA, all rights reserved)",
"issue": "3",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"pages": "485-503",
"publicationTitle": "Neuropsychology",
"shortTitle": "Neuropsychology of Adults With Attention-Deficit/Hyperactivity Disorder",
"volume": "18",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -340,7 +396,7 @@ var testCases = [
"tag": "Experimentation"
},
{
"tag": "Hyperkinesis"
"tag": "Hyperactivity"
},
{
"tag": "Inhibition (Personality)"
@ -362,7 +418,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://psycnet.apa.org/record/1956-05944-001",
"url": "https://psycnet.apa.org/record/1956-05944-001",
"items": [
{
"itemType": "journalArticle",
@ -381,16 +437,17 @@ var testCases = [
],
"date": "1955",
"DOI": "10.1037/h0043965",
"ISSN": "0022-1015(Print)",
"ISSN": "0022-1015",
"abstractNote": "Two factor analytic studies of meaningful judgments based upon the same sample of 50 bipolar descriptive scales are reported. Both analyses reveal three major connotative factors: evaluation, potency, and activity. These factors appear to be independent dimensions of the semantic space within which the meanings of concepts may be specified. (PsycINFO Database Record (c) 2016 APA, all rights reserved)",
"issue": "5",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"pages": "325-338",
"publicationTitle": "Journal of Experimental Psychology",
"volume": "50",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -417,7 +474,8 @@ var testCases = [
},
{
"type": "web",
"url": "http://psycnet.apa.org/record/1992-98221-010",
"url": "https://psycnet.apa.org/record/1992-98221-010",
"defer": true,
"items": [
{
"itemType": "bookSection",
@ -436,9 +494,9 @@ var testCases = [
],
"date": "1977",
"ISBN": "9780716703686 9780716703679",
"abstractNote": "tonic immobility [animal hypnosis] might be a useful laboratory analog or research model for catatonia / we have been collaborating on an interdisciplinary program of research in an effort to pinpoint the behavioral antecedents and biological bases for tonic immobility / attempt to briefly summarize our findings, and . . . discuss the implications of these data in terms of the model characteristics of tonic immobility / hypnosis / catatonia, catalepsy, and cataplexy / tonic immobility as a model for catatonia / fear potentiation / fear alleviation / fear or arousal / learned helplessness / neurological correlates / pharmacology and neurochemistry / genetic underpinnings / evolutionary considerations / implications for human psychopathology (PsycINFO Database Record (c) 2016 APA, all rights reserved)",
"abstractNote": "tonic immobility [animal hypnosis] might be a useful laboratory analog or research model for catatonia / we have been collaborating on an interdisciplinary program of research in an effort to pinpoint the behavioral antecedents and biological bases for tonic immobility / attempt to briefly summarize our findings, and . . . discuss the implications of these data in terms of the model characteristics of tonic immobility / hypnosis / catatonia, catalepsy, and cataplexy / tonic immobility as a model for catatonia / fear potentiation / fear alleviation / fear or arousal / learned helplessness / neurological correlates / pharmacology and neurochemistry / genetic underpinnings / evolutionary considerations / implications for human psychopathology (PsycInfo Database Record (c) 2022 APA, all rights reserved)",
"bookTitle": "Psychopathology: Experimental models",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"pages": "334-357",
"place": "New York, NY, US",
"publisher": "W H Freeman/Times Books/ Henry Holt & Co",
@ -446,7 +504,8 @@ var testCases = [
"shortTitle": "Catatonia",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -482,7 +541,8 @@ var testCases = [
},
{
"type": "web",
"url": "http://psycnet.apa.org/record/2004-16329-000?doi=1",
"url": "https://psycnet.apa.org/record/2004-16329-000?doi=1",
"defer": true,
"items": [
{
"itemType": "book",
@ -495,9 +555,9 @@ var testCases = [
}
],
"date": "1948",
"abstractNote": "The author's intent is to write about abnormal people in a way that will be valuable and interesting to students new to the subject. A first course in abnormal psychology is not intended to train specialists. Its goal is more general: it should provide the student with the opportunity to whet his interest, expand his horizons, register a certain body of new facts, and relate this to the rest of his knowledge about mankind. I have tried to present the subject in such a way as to emphasize its usefulness to all students of human nature. I have tried the experiment of writing two introductory chapters, one historical and the other clinical. This reflects my desire to set the subject-matter in a broad perspective and at the same time to anchor it in concrete fact. Next comes a block of six chapters designed to set forth the topics of maladjustment and neurosis. The two chapters on psychotherapy complete the more purely psychological or developmental part of the work. In the final chapter the problem of disordered personalities is allowed to expand to its full social dimensions. Treatment, care, and prevention call for social effort and social organization. I have sought to show some of the lines, both professional and nonprofessional, along which this effort can be expended. (PsycINFO Database Record (c) 2016 APA, all rights reserved)",
"abstractNote": "The author's intent is to write about abnormal people in a way that will be valuable and interesting to students new to the subject. A first course in abnormal psychology is not intended to train specialists. Its goal is more general: it should provide the student with the opportunity to whet his interest, expand his horizons, register a certain body of new facts, and relate this to the rest of his knowledge about mankind. I have tried to present the subject in such a way as to emphasize its usefulness to all students of human nature. I have tried the experiment of writing two introductory chapters, one historical and the other clinical. This reflects my desire to set the subject-matter in a broad perspective and at the same time to anchor it in concrete fact. Next comes a block of six chapters designed to set forth the topics of maladjustment and neurosis. The two chapters on psychotherapy complete the more purely psychological or developmental part of the work. In the final chapter the problem of disordered personalities is allowed to expand to its full social dimensions. Treatment, care, and prevention call for social effort and social organization. I have sought to show some of the lines, both professional and nonprofessional, along which this effort can be expended. (PsycInfo Database Record (c) 2022 APA, all rights reserved)",
"extra": "DOI: 10.1037/10023-000",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"numPages": "x, 617",
"place": "New York, NY, US",
"publisher": "Ronald Press Company",
@ -505,7 +565,8 @@ var testCases = [
"shortTitle": "The abnormal personality",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -518,9 +579,99 @@ var testCases = [
}
]
},
{
"type": "web",
"url": "https://psycnet.apa.org/fulltext/2022-40433-002.html",
"items": [
{
"itemType": "journalArticle",
"title": "Expertise in emotion: A scoping review and unifying framework for individual differences in the mental representation of emotional experience",
"creators": [
{
"lastName": "Hoemann",
"firstName": "Katie",
"creatorType": "author"
},
{
"lastName": "Nielson",
"firstName": "Catie",
"creatorType": "author"
},
{
"lastName": "Yuen",
"firstName": "Ashley",
"creatorType": "author"
},
{
"lastName": "Gurera",
"firstName": "J. W.",
"creatorType": "author"
},
{
"lastName": "Quigley",
"firstName": "Karen S.",
"creatorType": "author"
},
{
"lastName": "Barrett",
"firstName": "Lisa Feldman",
"creatorType": "author"
}
],
"date": "2021",
"DOI": "10.1037/bul0000327",
"ISSN": "1939-1455",
"abstractNote": "Expertise refers to outstanding skill or ability in a particular domain. In the domain of emotion, expertise refers to the observation that some people are better at a range of competencies related to understanding and experiencing emotions, and these competencies may help them lead healthier lives. These individual differences are represented by multiple constructs including emotional awareness, emotional clarity, emotional complexity, emotional granularity, and emotional intelligence. These constructs derive from different theoretical perspectives, highlight different competencies, and are operationalized and measured in different ways. The full set of relationships between these constructs has not yet been considered, hindering scientific progress and the translation of findings to aid mental and physical well-being. In this article, we use a scoping review procedure to integrate these constructs within a shared conceptual space. Scoping reviews provide a principled means of synthesizing large and diverse literature in a transparent fashion, enabling the identification of similarities as well as gaps and inconsistencies across constructs. Using domain-general accounts of expertise as a guide, we build a unifying framework for expertise in emotion and apply this to constructs that describe how people understand and experience their own emotions. Our approach offers opportunities to identify potential mechanisms of expertise in emotion, encouraging future research on those mechanisms and on educational or clinical interventions. (PsycInfo Database Record (c) 2023 APA, all rights reserved)",
"issue": "11",
"libraryCatalog": "APA PsycNet",
"pages": "1159-1183",
"publicationTitle": "Psychological Bulletin",
"shortTitle": "Expertise in emotion",
"volume": "147",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Alexithymia"
},
{
"tag": "Awareness"
},
{
"tag": "Conceptual Imagery"
},
{
"tag": "Creativity"
},
{
"tag": "Emotional Intelligence"
},
{
"tag": "Emotions"
},
{
"tag": "Experience Level"
},
{
"tag": "Experiences (Events)"
},
{
"tag": "Individual Differences"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://psycnet.apa.org/buy/2004-16329-002",
"defer": true,
"items": [
{
"itemType": "bookSection",
@ -561,7 +712,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://psycnet.apa.org/buy/2010-19350-001",
"url": "https://psycnet.apa.org/record/2010-19350-001",
"items": [
{
"itemType": "journalArticle",
@ -595,16 +746,17 @@ var testCases = [
],
"date": "2010",
"DOI": "10.1037/a0020280",
"ISSN": "1939-2222(Electronic),0096-3445(Print)",
"ISSN": "1939-2222",
"abstractNote": "Social scientists often rely on economic experiments such as ultimatum and dictator games to understand human cooperation. Systematic deviations from economic predictions have inspired broader conceptions of self-interest that incorporate concerns for fairness. Yet no framework can describe all of the major results. We take a different approach by asking players directly about their self-interest—defined as what they want to do (pleasure-maximizing options). We also ask players directly about their sense of fairness—defined as what they think they ought to do (fairness-maximizing options). Player-defined measures of self-interest and fairness predict (a) the majority of ultimatum-game and dictator-game offers, (b) ultimatum-game rejections, (c) exiting behavior (i.e., escaping social expectations to cooperate) in the dictator game, and (d) who cooperates more after a positive mood induction. Adopting the players' perspectives of self-interest and fairness permits better predictions about who cooperates, why they cooperate, and when they punish noncooperators. (PsycINFO Database Record (c) 2016 APA, all rights reserved)",
"issue": "4",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"pages": "743-755",
"publicationTitle": "Journal of Experimental Psychology: General",
"volume": "139",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -634,7 +786,8 @@ var testCases = [
},
{
"type": "web",
"url": "http://psycnet.apa.org/record/2010-09295-002",
"url": "https://psycnet.apa.org/record/2010-09295-002",
"defer": true,
"items": [
{
"itemType": "bookSection",
@ -648,17 +801,18 @@ var testCases = [
],
"date": "2011",
"ISBN": "9781433808616 9781433808623",
"abstractNote": "In this chapter, I seek to redress vocational psychologys inattention to the self and address the ambiguity of the meaning of self. To begin, I offer a chronological survey of vocational psychologys three main views of human singularity. During succeeding historical eras, different aspects of human singularity interested vocational psychologists, so they developed a new set of terms and concepts to deal with shifts in the meaning of individuality. Over time, vocational psychology developed what Kuhn (2000) referred to as language communities, each with its own paradigm for understanding the self and vocational behavior. Because the self is fundamentally ambiguous, adherents to each paradigm describe it with an agreed on language and metaphors. Thus, each paradigm has a textual tradition, or way of talking about the self. As readers shall see, when they talk about individuals, differentialists use the language of personality, developmentalists use the language of personhood, and constructionists use the language of identity. (PsycINFO Database Record (c) 2017 APA, all rights reserved)",
"abstractNote": "In this chapter, I seek to redress vocational psychologys inattention to the self and address the ambiguity of the meaning of self. To begin, I offer a chronological survey of vocational psychologys three main views of human singularity. During succeeding historical eras, different aspects of human singularity interested vocational psychologists, so they developed a new set of terms and concepts to deal with shifts in the meaning of individuality. Over time, vocational psychology developed what Kuhn (2000) referred to as language communities, each with its own paradigm for understanding the self and vocational behavior. Because the self is fundamentally ambiguous, adherents to each paradigm describe it with an agreed on language and metaphors. Thus, each paradigm has a textual tradition, or way of talking about the self. As readers shall see, when they talk about individuals, differentialists use the language of personality, developmentalists use the language of personhood, and constructionists use the language of identity. (PsycInfo Database Record (c) 2024 APA, all rights reserved)",
"bookTitle": "Developing self in work and career: Concepts, cases, and contexts",
"extra": "DOI: 10.1037/12348-002",
"libraryCatalog": "APA PsycNET",
"libraryCatalog": "APA PsycNet",
"pages": "17-33",
"place": "Washington, DC, US",
"publisher": "American Psychological Association",
"shortTitle": "The self in vocational psychology",
"attachments": [
{
"title": "Snapshot"
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
@ -676,6 +830,86 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://psycnet.apa.org/record/2025-80032-001?doi=1",
"items": [
{
"itemType": "journalArticle",
"title": "Linking adolescent bullying perpetration with adult fertility: Two preliminary studies",
"creators": [
{
"lastName": "Volk",
"firstName": "Anthony A.",
"creatorType": "author"
},
{
"lastName": "Brazil",
"firstName": "Kristopher J.",
"creatorType": "author"
},
{
"lastName": "Dane",
"firstName": "Andrew V.",
"creatorType": "author"
},
{
"lastName": "Vaillancourt",
"firstName": "Tracy",
"creatorType": "author"
},
{
"lastName": "Al-Jbouri",
"firstName": "Elizabeth",
"creatorType": "author"
},
{
"lastName": "Farrell",
"firstName": "Ann H.",
"creatorType": "author"
}
],
"date": "2025",
"DOI": "10.1037/ebs0000374",
"ISSN": "2330-2933",
"abstractNote": "Researchers have suggested that bullying perpetration is, at least in part, an evolved adaptation. A key prediction of this evolutionary perspective is that bullying facilitates the transmission of genes from one generation to the next. To date, only one study (using a limited measure of bullying) has examined the link between adolescent bullying and adult fertility, showing a positive association between adolescent bullying and number of children in adulthood. We sought to replicate and expand this unique finding using a more robust measure of adolescent bullying and young adults parental status in a prospective longitudinal study of Canadians (Study 1), along with an MTurk study of retrospective adolescent bullying and current adult fertility (Study 2). In support of an evolutionary theory of bullying, we found that higher bullying was associated with having children in young adulthood (ages 23 and/or 24 years, Study 1) and that retrospective reports of adolescent bullying were associated with having more children in adulthood (Study 2). Overall, our studies offer additional support for the idea that adolescent bullying is, at least in part, an evolutionary adaptation that may help individuals to later pass on their genes to future generations through enhanced reproductive and perhaps parental effort. Although needing replication, our data highlight the importance of considering reproductive outcomes when designing future bullying research or interventions. (PsycInfo Database Record (c) 2025 APA, all rights reserved)",
"libraryCatalog": "APA PsycNet",
"publicationTitle": "Evolutionary Behavioral Sciences",
"shortTitle": "Linking adolescent bullying perpetration with adult fertility",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Adaptation"
},
{
"tag": "Adolescent Characteristics"
},
{
"tag": "Bullying"
},
{
"tag": "Fertility"
},
{
"tag": "Genes"
},
{
"tag": "Parenthood Status"
},
{
"tag": "Theory of Evolution"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -1,165 +1,204 @@
{
"translatorID": "f318ab1e-71c6-4f67-8ac3-4b1144e5bf4e",
"label": "APS-Physics",
"creator": "Will Shanks",
"target": "^https?://(www\\.)?(physics)\\.aps\\.org([^/]*/(articles|story)/?|/browse(\\?|$))",
"creator": "Will Shanks and Abe Jellinek",
"target": "^https?://(www\\.)?(physics)\\.aps\\.org/",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2013-12-06 17:44:20"
"lastUpdated": "2021-08-31 22:13:29"
}
// Works for APS Physics Viewpoints and Focus articles: http://physics.aps.org/
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.indexOf("/browse")!=-1) return "multiple";
else return "journalArticle";
if (doc.querySelector('meta[name="citation_title"]')) {
return "journalArticle";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h3.feed-item-title > a[href*="/articles/"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url)=="multiple"){
var items = {};
var articles = [];
var links = ZU.xpath(doc, '//div[@class="result-title"]/h2/a[contains(@href, "/story/") or contains(@href, "/articles/")]')
for (var i in links){
items[ZU.xpathText(links[i], './@href')] = ZU.xpathText(links[i], './text()')
}
Zotero.selectItems(items, function (items) {
if (!items) {
return true;
}
for (var itemurl in items) {
articles.push(itemurl);
}
ZU.processDocuments(articles, scrape)
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else scrape(doc, url);
else {
scrape(doc, url);
}
}
function scrape(doc, url){
Zotero.debug(doc.title);
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
//Get abstract (called 'byline' on page)
var abs = ZU.xpathText(doc, '//article/header/p[contains(@class, "byline")]');
//Check if page is a Viewpoint. Only Viewpoints have PDFs
var title = ZU.xpathText(doc, '//article/header/h1[contains(@class, "title")]');
var hasPDF = (title.indexOf('Viewpoint:') != -1);
//Get DOI
var doi = ZU.xpathText(doc, '//article/header/div[contains(@class, "pubinfo")]/text()');
doi = doi.match(/10\.[^\s]+/)[0]
//Set up urls
var pdfurl = 'http://physics.aps.org/articles/pdf/' + doi;
var urlRIS = 'http://physics.aps.org/articles/export/' + doi + '/ris';
Zotero.Utilities.HTTP.doGet(urlRIS, function(text) {
//DOI is stored in ID field. Fix it.
text = text.replace(/^ID\s\s?-\s/mg, 'DO - ');
// load translator for RIS
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function(obj, item) {
item.attachments = [
{document:doc, title:"APS Snapshot"}];
if (hasPDF) {
item.attachments.push({url:pdfurl, title:"APS Full Text PDF", mimeType:"application/pdf"});
}
if (abs) item.abstractNote = abs;
item.complete();
translator.setHandler('itemDone', function (obj, item) {
if (!item.DOI) {
item.DOI = ZU.cleanDOI(attr(doc, 'a[href*="link.aps.org/doi"]', 'href'));
}
// both snapshot and PDF: HTML is commentary, PDF is article
item.attachments = [];
item.attachments.push({
title: 'Snapshot',
document: doc
});
translator.translate();
item.attachments.push({
title: 'Full Text PDF',
mimeType: 'application/pdf',
url: `https://physics.aps.org/articles/pdf/${item.DOI}`
});
item.libraryCatalog = 'APS Physics';
item.complete();
});
}/** BEGIN TEST CASES **/
translator.getTranslatorObject(function (trans) {
trans.addCustomFields({
'citation_pages': 'pages'
});
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://physics.aps.org/articles/v5/100",
"url": "https://physics.aps.org/articles/v5/100",
"items": [
{
"itemType": "journalArticle",
"title": "Surface Folds Make Tears and Chips",
"creators": [
{
"lastName": "de Beer",
"firstName": "Sissi",
"firstName": "Sissi de",
"lastName": "Beer",
"creatorType": "author"
},
{
"lastName": "Müser",
"firstName": "Martin H.",
"lastName": "Müser",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "2012/09/04",
"DOI": "10.1103/PhysRevLett.109.106001",
"abstractNote": "Fluidlike folding instabilities of solid surfaces complicate the machining of metals to perfection",
"language": "en",
"libraryCatalog": "APS Physics",
"pages": "100",
"publicationTitle": "Physics",
"rights": "©2012 by the American Physical Society. All rights reserved.",
"url": "https://physics.aps.org/articles/v5/100",
"volume": "5",
"attachments": [
{
"title": "APS Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "APS Full Text PDF",
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"publisher": "American Physical Society",
"DOI": "10.1103/Physics.5.100",
"title": "Surface Folds Make Tears and Chips",
"publicationTitle": "Physics",
"journalAbbreviation": "Physics",
"volume": "5",
"pages": "100",
"date": "September 4, 2012",
"url": "http://link.aps.org/doi/10.1103/Physics.5.100",
"abstractNote": "Fluidlike folding instabilities of solid surfaces complicate the machining of metals to perfection",
"libraryCatalog": "APS-Physics",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://physics.aps.org/articles/v5/101",
"url": "https://physics.aps.org/articles/v5/101",
"items": [
{
"itemType": "journalArticle",
"title": "Measuring the Smallest Trickle",
"creators": [
{
"lastName": "Schirber",
"firstName": "Michael",
"lastName": "Schirber",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "2012/09/10",
"DOI": "10.1103/PhysRevLett.109.118302",
"abstractNote": "Researchers used a nanoscale tunnel in a silicon chip to measure a flow rate of a few picoliters per minute, which is smaller than any previous observation.",
"language": "en",
"libraryCatalog": "APS Physics",
"pages": "101",
"publicationTitle": "Physics",
"rights": "©2012 by the American Physical Society. All rights reserved.",
"url": "https://physics.aps.org/articles/v5/101",
"volume": "5",
"attachments": [
{
"title": "APS Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"publisher": "American Physical Society",
"DOI": "10.1103/Physics.5.101",
"title": "Measuring the Smallest Trickle",
"publicationTitle": "Physics",
"journalAbbreviation": "Physics",
"volume": "5",
"pages": "101",
"date": "September 10, 2012",
"url": "http://link.aps.org/doi/10.1103/Physics.5.101",
"abstractNote": "Researchers used a nanoscale tunnel in a silicon chip to measure a flow rate of a few picoliters per minute, which is smaller than any previous observation.",
"libraryCatalog": "APS-Physics",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://physics.aps.org/browse/?page=1&per_page=10&sort=relevance&q=test",
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

228
APS.js
View File

@ -1,7 +1,7 @@
{
"translatorID": "2c310a37-a4dd-48d2-82c9-bd29c53c1c76",
"label": "APS",
"creator": "Aurimas Vinckevicius",
"creator": "Aurimas Vinckevicius and Abe Jellinek",
"target": "^https?://journals\\.aps\\.org/([^/]+/(abstract|supplemental|references|cited-by|issues)/|search(\\?|/))",
"minVersion": "3.0.12",
"maxVersion": "",
@ -9,24 +9,52 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-01-14 21:44:41"
"lastUpdated": "2024-11-21 18:50:09"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2024 Aurimas Vinckevicius and Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
var title = doc.getElementById('title');
if (title && ZU.xpath(title, './/a[@id="export-article-link"]').length) {
if (doc.querySelector('#article-body #export-article-dialog')
|| doc.querySelector('main#main') && /^\/[^/]+\/(abstract|supplemental|references|cited-by)\//.test(new URL(url).pathname)) {
return "journalArticle";
} else if (getSearchResults(doc, true)){
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//div[contains(@class, "search-results")]//div[contains(@class, "row")]//h5/a');
for (var i=0; i<rows.length; i++) {
var rows = doc.querySelectorAll('#issue-body .headline .title > a');
if (!rows.length) {
rows = doc.querySelectorAll('#search-main h3 > a');
}
for (var i = 0; i < rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(cleanMath(rows[i].textContent));
if (!href || !title) continue;
@ -42,7 +70,7 @@ function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
return;
}
var articles = [];
for (var i in items) {
@ -50,7 +78,8 @@ function doWeb(doc, url) {
}
ZU.processDocuments(articles, scrape);
});
} else {
}
else {
scrape(doc, url);
}
}
@ -58,13 +87,13 @@ function doWeb(doc, url) {
// Extension to mimeType mapping
var suppTypeMap = {
'pdf': 'application/pdf',
'zip': 'application/zip',
'doc': 'application/msword',
'docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls': 'application/vnd.ms-excel',
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'mov': 'video/quicktime'
pdf: 'application/pdf',
zip: 'application/zip',
doc: 'application/msword',
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
xls: 'application/vnd.ms-excel',
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
mov: 'video/quicktime'
};
var dontDownload = [
@ -75,20 +104,20 @@ var dontDownload = [
function scrape(doc, url) {
url = url.replace(/[?#].*/, '');
if (url.indexOf('/abstract/') == -1) {
if (!url.includes('/abstract/')) {
// Go to Abstract page first so we can scrape the abstract
url = url.replace(/\/(?:supplemental|references|cited-by)\//, '/abstract/');
if (url.indexOf('/abstract/') == -1) {
if (!url.includes('/abstract/')) {
Zotero.debug('Unrecognized URL ' + url);
return;
}
ZU.processDocuments(url, function(doc, url) {
if (url.indexOf('/abstract/') == -1) {
ZU.processDocuments(url, function (doc, url) {
if (!url.includes('/abstract/')) {
Zotero.debug('Redirected when trying to go to abstract page. ' + url);
return;
}
scrape(doc, url)
scrape(doc, url);
});
return;
}
@ -97,26 +126,23 @@ function scrape(doc, url) {
// fetch RIS
var risUrl = url.replace('{REPLACE}', 'export')
+ '?type=ris&download=true';
ZU.doGet(risUrl, function(text) {
text = text.replace(/^ID\s+-\s+/mg, 'DO - ');
+ '?type=ris&download=true';
ZU.doGet(risUrl, function (risText) {
risText = risText.replace(/^ID\s+-\s+/mg, 'DO - ');
var trans = Zotero.loadTranslator('import');
trans.setTranslator('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7'); //RIS
trans.setString(text);
trans.setHandler('itemDone', function(obj, item) {
trans.setString(risText);
trans.setHandler('itemDone', function (obj, item) {
// scrape abstract from page
item.abstractNote = ZU.trimInternal(cleanMath(
ZU.xpathText(doc, '//section[contains(@class,"abstract")]/div[@class="content"]/p[1]')
text(doc, '#abstract-section-content p')
));
// attach PDF
if (ZU.xpath(doc, '//div[@class="article-nav-actions"]/a[contains(text(), "PDF")]').length) {
item.attachments.push({
title: 'Full Text PDF',
url: url.replace('{REPLACE}', 'pdf'),
mimeType: 'application/pdf'
});
}
item.attachments.push({
title: 'Full Text PDF',
url: url.replace('{REPLACE}', 'pdf'),
mimeType: 'application/pdf'
});
item.attachments.push({
title: "APS Snapshot",
@ -124,38 +150,37 @@ function scrape(doc, url) {
});
if (Z.getHiddenPref && Z.getHiddenPref('attachSupplementary')) {
ZU.processDocuments(url.replace('{REPLACE}', 'supplemental'), function(doc) {
try {
var asLink = Z.getHiddenPref('supplementaryAsLink');
var suppFiles = doc.getElementsByClassName('supplemental-file');
for (var i=0; i<suppFiles.length; i++) {
var link = suppFiles[i].getElementsByTagName('a')[0];
if (!link || !link.href) continue;
var title = link.getAttribute('data-id') || 'Supplementary Data';
var type = suppTypeMap[link.href.split('.').pop()];
if (asLink || dontDownload.indexOf(type) != -1) {
item.attachments.push({
title: title,
url: link.href,
mimeType: type || 'text/html',
snapshot: false
});
} else {
item.attachments.push({
title: title,
url: link.href,
mimeType: type
});
}
try {
var asLink = Z.getHiddenPref('supplementaryAsLink');
var suppFiles = doc.querySelectorAll('.supplemental-file');
for (let suppFile of suppFiles) {
let link = suppFile.querySelector('a');
if (!link || !link.href) continue;
var title = link.getAttribute('data-id') || 'Supplementary Data';
var type = suppTypeMap[link.href.split('.').pop()];
if (asLink || dontDownload.includes(type)) {
item.attachments.push({
title: title,
url: link.href,
mimeType: type || 'text/html',
snapshot: false
});
}
else {
item.attachments.push({
title: title,
url: link.href,
mimeType: type
});
}
} catch (e) {
Z.debug('Could not attach supplemental data');
Z.debug(e);
}
}, function() { item.complete() });
} else {
item.complete();
}
catch (e) {
Z.debug('Could not attach supplemental data');
Z.debug(e);
}
}
item.complete();
});
trans.translate();
});
@ -165,6 +190,7 @@ function cleanMath(str) {
//math tags appear to have duplicate content and are somehow left in even after textContent
return str.replace(/<(math|mi)[^<>]*>.*?<\/\1>/g, '');
}
/** BEGIN TEST CASES **/
var testCases = [
{
@ -186,7 +212,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "October 21, 2011",
"date": "2011-10-21",
"DOI": "10.1103/PhysRevD.84.077701",
"abstractNote": "We reconsider Higgs boson invisible decays into Dark Matter in the light of recent Higgs searches at the LHC. Present hints in the Compact Muon Solenoid and ATLAS data favor a nonstandard Higgs boson with approximately 50% invisible branching ratio, and mass around 143 GeV. This situation can be realized within the simplest thermal scalar singlet Dark Matter model, predicting a Dark Matter mass around 50 GeV and direct detection cross section just below present bound. The present runs of the Xenon100 and LHC experiments can test this possibility.",
"issue": "7",
@ -202,7 +228,8 @@ var testCases = [
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -260,9 +287,9 @@ var testCases = [
"creatorType": "author"
}
],
"date": "March 4, 2015",
"date": "2015-03-04",
"DOI": "10.1103/PhysRevLett.114.098105",
"abstractNote": "Cellular aggregates (spheroids) are widely used in biophysics and tissue engineering as model systems for biological tissues. In this Letter we propose novel methods for molding stem-cell spheroids, deforming them, and measuring their interfacial and elastic properties with a single method based on cell tagging with magnetic nanoparticles and application of a magnetic field gradient. Magnetic molding yields spheroids of unprecedented sizes (up to a few mm in diameter) and preserves tissue integrity. On subjecting these spheroids to magnetic flattening (over 150g), we observed a size-dependent elastocapillary transition with two modes of deformation: liquid-drop-like behavior for small spheroids, and elastic-sphere-like behavior for larger spheroids, followed by relaxation to a liquidlike drop.",
"abstractNote": "Cellular aggregates (spheroids) are widely used in biophysics and tissue engineering as model systems for biological tissues. In this Letter we propose novel methods for molding stem-cell spheroids, deforming them, and measuring their interfacial and elastic properties with a single method based on cell tagging with magnetic nanoparticles and application of a magnetic field gradient. Magnetic molding yields spheroids of unprecedented sizes (up to a few mm in diameter) and preserves tissue integrity. On subjecting these spheroids to magnetic flattening (over ), we observed a size-dependent elastocapillary transition with two modes of deformation: liquid-drop-like behavior for small spheroids, and elastic-sphere-like behavior for larger spheroids, followed by relaxation to a liquidlike drop.",
"issue": "9",
"journalAbbreviation": "Phys. Rev. Lett.",
"libraryCatalog": "APS",
@ -276,7 +303,8 @@ var testCases = [
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -319,7 +347,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "March 17, 2015",
"date": "2015-03-17",
"DOI": "10.1103/PhysRevX.5.011029",
"abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.",
"issue": "1",
@ -335,7 +363,8 @@ var testCases = [
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -378,7 +407,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "March 17, 2015",
"date": "2015-03-17",
"DOI": "10.1103/PhysRevX.5.011029",
"abstractNote": "Based on first-principle calculations, we show that a family of nonmagnetic materials including TaAs, TaP, NbAs, and NbP are Weyl semimetals (WSM) without inversion centers. We find twelve pairs of Weyl points in the whole Brillouin zone (BZ) for each of them. In the absence of spin-orbit coupling (SOC), band inversions in mirror-invariant planes lead to gapless nodal rings in the energy-momentum dispersion. The strong SOC in these materials then opens full gaps in the mirror planes, generating nonzero mirror Chern numbers and Weyl points off the mirror planes. The resulting surface-state Fermi arc structures on both (001) and (100) surfaces are also obtained, and they show interesting shapes, pointing to fascinating playgrounds for future experimental studies.",
"issue": "1",
@ -394,7 +423,8 @@ var testCases = [
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -437,7 +467,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "January 20, 2015",
"date": "2015-01-20",
"DOI": "10.1103/PhysRevX.5.011003",
"abstractNote": "We report on a stringent test of the nonclassicality of the motion of a massive quantum particle, which propagates on a discrete lattice. Measuring temporal correlations of the position of single atoms performing a quantum walk, we observe a 6σ violation of the Leggett-Garg inequality. Our results rigorously excludes (i.e., falsifies) any explanation of quantum transport based on classical, well-defined trajectories. We use so-called ideal negative measurements—an essential requisite for any genuine Leggett-Garg test—to acquire information about the atoms position, yet avoiding any direct interaction with it. The interaction-free measurement is based on a novel atom transport system, which allows us to directly probe the absence rather than the presence of atoms at a chosen lattice site. Beyond the fundamental aspect of this test, we demonstrate the application of the Leggett-Garg correlation function as a witness of quantum superposition. Here, we employ the witness to discriminate different types of walks spanning from merely classical to wholly quantum dynamics.",
"issue": "1",
@ -453,7 +483,53 @@ var testCases = [
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot"
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.032314",
"items": [
{
"itemType": "journalArticle",
"title": "Computable measure of entanglement",
"creators": [
{
"lastName": "Vidal",
"firstName": "G.",
"creatorType": "author"
},
{
"lastName": "Werner",
"firstName": "R. F.",
"creatorType": "author"
}
],
"date": "2002-02-22",
"DOI": "10.1103/PhysRevA.65.032314",
"abstractNote": "We present a measure of entanglement that can be computed effectively for any mixed state of an arbitrary bipartite system. We show that it does not increase under local manipulations of the system, and use it to obtain a bound on the teleportation capacity and on the distillable entanglement of mixed states.",
"issue": "3",
"journalAbbreviation": "Phys. Rev. A",
"libraryCatalog": "APS",
"pages": "032314",
"publicationTitle": "Physical Review A",
"url": "https://link.aps.org/doi/10.1103/PhysRevA.65.032314",
"volume": "65",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
},
{
"title": "APS Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -463,4 +539,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View File

@ -1,150 +1,186 @@
{
"translatorID": "72cb2536-3211-41e0-ae8b-974c0385e085",
"label": "ARTFL Encyclopedie",
"creator": "Sean Takats, Sebastian Karcher",
"target": "^https?://artflsrv\\d+\\.uchicago\\.edu/cgi-bin/philologic/(getobject\\.pl\\?[cp]\\.[0-9]+:[0-9]+(:[0-9]+)?\\.encyclopedie|navigate\\.pl\\?encyclopedie|search3t\\?dbname=encyclopedie)",
"creator": "Sean Takats, Sebastian Karcher, and Abe Jellinek",
"target": "^https?://artflsrv\\d+\\.uchicago\\.edu/philologic4/encyclopedie\\d+/(navigate/|query)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcv",
"lastUpdated": "2017-01-01 16:50:31"
"browserSupport": "gcsibv",
"lastUpdated": "2021-06-30 19:55:06"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.indexOf("getobject.pl") != -1){
if (url.includes('/navigate/')) {
return "encyclopediaArticle";
} else if (url.indexOf("navigate.pl")!=-1){//browsing
}
else if (getSearchResults(doc, true)) {
return "multiple";
} else if (url.indexOf("search3t?")!=-1){//search results
return "multiple"
}
return false;
}
function reconcileAuthor(author){
var authorMap = {
"Venel":"Venel, Gabriel-François",
"d'Aumont":"d'Aumont, Arnulphe",
"de La Chapelle":"de La Chapelle, Jean-Baptiste",
"Bourgelat":"Bourgelat, Claude",
"Dumarsais":"Du Marsais, César Chesneau",
"Mallet":"Mallet, Edme-François",
"Toussaint":"Toussaint, François-Vincent",
"Daubenton":"Daubenton, Louis-Jean-Marie",
"d'Argenville": "d'Argenville, Antoine-Joseph Desallier",
"Tarin":"Tarin, Pierre",
"Vandenesse":"de Vandenesse, Urbain",
"Blondel": "Blondel, Jacques-François",
"Le Blond":"Le Blond, Guillaume",
"Rousseau":"Rousseau, Jean-Jacques",
"Eidous":"Eidous, Marc-Antoine",
"d'Alembert":"d'Alembert, Jean le Rond",
"Louis":"Louis, Antoine",
"Bellin":"Bellin, Jacques-Nicolas",
"Diderot":"Diderot, Denis",
"Diderot1":"Diderot, Denis",
"Diderot2":"Diderot, Denis",
"de Jaucourt":"de Jaucourt, Chevalier Louis",
"Jaucourt":"de Jaucourt, Chevalier Louis",
"d'Holbach":"d'Holbach, Baron"
/* not yet mapped
Yvon
Forbonnais
Douchet and Beauzée
Boucher d'Argis
Lenglet Du Fresnoy
Cahusac
Pestré
Daubenton, le Subdélégué
Goussier
de Villiers
Barthès
Morellet
Malouin
Ménuret de Chambaud
Landois
Le Roy
*/
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.philologic_cite .citation:first-child a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
if (authorMap[author]) {
author = authorMap[author];
}
// remove ARTFL's trailing 5 for odd contributors (e.g. Turgot5)
if (author.substr(author.length-1, 1)=="5"){
author = author.substr(0, author.length-1);
}
return author;
}
function scrape (doc, url){
var newItem = new Zotero.Item("encyclopediaArticle");
newItem.title = ZU.xpathText(doc, '(//index[@type="headword"])[1]/@value')
newItem.encyclopediaTitle = "Encyclopédie, ou Dictionnaire raisonné des sciences, des arts et des métiers";
newItem.shortTitle = "Encyclopédie";
newItem.date = "1751-1772";
newItem.publisher = "Briasson";
newItem.place = "Paris";
newItem.numberOfVolumes = "17";
newItem.creators.push({firstName:"Denis", lastName:"Diderot", creatorType:"editor"});
newItem.creators.push({firstName:"Jean le Rond", lastName:"d'Alembert", creatorType:"editor"});
newItem.url = url;
newItem.attachments.push({title:"ARTFL Snapshot", mimeType:"text/html", document:doc});
var volpage = ZU.xpathText(doc, '(//index/a[contains(@href, "getobject.pl") and contains(text(), ":")])[1]');
if (!volpage){//pageview
var volpage = ZU.xpathText(doc, '//div[@id="content"]/center[contains(text(), ":")]/text()')
}
if (volpage){
volpage = volpage.match(/(\d+):([A-Z\d]+)/); //page number can have letters
newItem.volume = volpage[1];
newItem.pages = volpage[2];
}
var authors = ZU.xpathText(doc, '(//index[@type="author"])[1]/@value');
if (authors){
author = authors.split(/\s*\|\s*/);
for (var i =0; i<author.length; i++){
newItem.creators.push(ZU.cleanAuthor(reconcileAuthor(author[i]), "author", true))
}
}
newItem.complete();
return found ? items : false;
}
function doWeb(doc, url) {
if (url.indexOf("getobject.pl") != -1){
// single article
scrape(doc, url);
} else {
//search page
var items = {};
var urls = [];
var xpath = '//a[contains(@href, "getobject.pl")]';
var elmts = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
var elmt;
while (elmt = elmts.iterateNext()){
var title = elmt.textContent;
var link = elmt.href;
if (title && link){
items[link] = title;
}
}
Z.selectItems(items, function(items) {
if (items == null) return true;
for (var j in items) {
urls.push(j);
}
ZU.processDocuments(urls, scrape);
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
}/** BEGIN TEST CASES **/
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
let path = url.match(/(\/philologic4\/[^/]+\/)navigate((?:\/\d+)+)/);
if (!path) {
throw new Error('Unknown entry path format');
}
let [, base, id] = path;
id = id.replace(/\//g, ' ').trim();
ZU.doGet(
`${base}reports/navigation.py?report=navigation&philo_id=${id}&byte=`,
function (respText) {
let json = JSON.parse(respText);
scrapeFromJSON(doc, url, json);
}
);
}
function scrapeFromJSON(doc, url, json) {
let item = new Zotero.Item('encyclopediaArticle');
let meta = json.metadata_fields;
item.title = meta.head;
item.encyclopediaTitle = meta.title.replace(/\.?\s*Tome \d+\.?/, '');
item.volume = meta.vol;
item.numberOfVolumes = '17';
item.place = meta.pub_place;
item.publisher = meta.publisher;
item.date = meta.pub_date;
let firstPage;
let lastPage;
let pageRe = /\[page \d+:([\da-zA-Z]+)\]/g;
let matchArray;
while ((matchArray = pageRe.exec(json.text)) !== null) {
// iterate through page heading matches. if we haven't set the first
// page yet, set it to the page in the heading we just found. always
// set the last page to the heading we just found. when we're done,
// the first page will correspond to the first heading and the last page
// to the last.
if (!firstPage) {
firstPage = matchArray[1];
}
lastPage = matchArray[1];
}
if (firstPage && lastPage) {
if (firstPage == lastPage) {
item.pages = firstPage;
}
else {
item.pages = `${firstPage}-${lastPage}`;
}
}
item.url = url;
item.language = 'fr';
item.archive = 'ARTFL Encyclopédie Project (Spring 2021 Edition)';
item.libraryCatalog = '';
item.creators.push({
firstName: "Denis",
lastName: "Diderot",
creatorType: "editor"
});
item.creators.push({
firstName: "Jean le Rond",
lastName: "d'Alembert",
creatorType: "editor"
});
item.creators.push(
ZU.cleanAuthor(
meta.kafauth.replace(/\s*\(.*\)/, ''), 'author', true
)
);
if (doc) {
item.attachments.push({
title: 'Snapshot',
document: doc
});
}
if (json.imgs.current_obj_img && json.imgs.current_obj_img.length) {
let url = json.imgs.current_obj_img[0];
item.attachments.push({
title: 'Page Scan',
mimeType: `image/${url.split('.').pop()}`,
url
});
}
item.complete();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/getobject.pl?c.0:683:1.encyclopedie0513",
"url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/929/",
"items": [
{
"itemType": "encyclopediaArticle",
"title": "ADULTERE",
"creators": [
{
"firstName": "Denis",
@ -156,51 +192,45 @@ var testCases = [
"lastName": "d'Alembert",
"creatorType": "editor"
},
{
"lastName": "Yvon",
"creatorType": "author"
},
{
"firstName": "François-Vincent",
"lastName": "Toussaint",
"creatorType": "author"
},
{
"firstName": "Denis",
"lastName": "Diderot",
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "1751",
"archive": "ARTFL Encyclopédie Project (Spring 2021 Edition)",
"encyclopediaTitle": "Encyclopédie, Dictionnaire raisonné des sciences, des arts et des métiers, par une Société de Gens de lettres",
"language": "fr",
"numberOfVolumes": "17",
"pages": "150",
"place": "Paris",
"publisher": "Le Breton",
"url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/929/",
"volume": "1",
"attachments": [
{
"title": "ARTFL Snapshot",
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "Page Scan",
"mimeType": "image/jpeg"
}
],
"title": "Adultere",
"encyclopediaTitle": "Encyclopédie, ou Dictionnaire raisonné des sciences, des arts et des métiers",
"shortTitle": "Encyclopédie",
"date": "1751-1772",
"publisher": "Briasson",
"place": "Paris",
"numberOfVolumes": "17",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/getobject.pl?c.0:683:1.encyclopedie0513",
"volume": "1",
"pages": "150",
"libraryCatalog": "ARTFL Encyclopedie",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/getobject.pl?p.0:203.encyclopedie0513",
"url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/925/",
"items": [
{
"itemType": "encyclopediaArticle",
"title": "ADULTE",
"creators": [
{
"firstName": "Denis",
@ -218,39 +248,36 @@ var testCases = [
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "1751",
"archive": "ARTFL Encyclopédie Project (Spring 2021 Edition)",
"encyclopediaTitle": "Encyclopédie, Dictionnaire raisonné des sciences, des arts et des métiers, par une Société de Gens de lettres",
"language": "fr",
"numberOfVolumes": "17",
"pages": "150",
"place": "Paris",
"publisher": "Le Breton",
"url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/navigate/1/925/",
"volume": "1",
"attachments": [
{
"title": "ARTFL Snapshot",
"title": "Snapshot",
"mimeType": "text/html"
},
{
"title": "Page Scan",
"mimeType": "image/jpeg"
}
],
"title": "ADULTE",
"encyclopediaTitle": "Encyclopédie, ou Dictionnaire raisonné des sciences, des arts et des métiers",
"shortTitle": "Encyclopédie",
"date": "1751-1772",
"publisher": "Briasson",
"place": "Paris",
"numberOfVolumes": "17",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/getobject.pl?p.0:203.encyclopedie0513",
"volume": "1",
"pages": "150",
"libraryCatalog": "ARTFL Encyclopedie",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/search3t?dbname=encyclopedie0513&word=amour&CONJUNCT=PHRASE&dgdivhead=&dgdivocauthor=&ExcludeDiderot3=on&dgdivocsalutation=&OUTPUT=conc&POLESPAN=5",
"items": "multiple"
},
{
"type": "web",
"url": "http://artflsrv02.uchicago.edu/cgi-bin/philologic/search3t?dbname=encyclopedie0513&dgdivhead=EAU",
"url": "https://artflsrv03.uchicago.edu/philologic4/encyclopedie0521/query?report=concordance&method=proxy&attribution=&objecttype=&q=amour&start=0&end=0",
"items": "multiple"
}
]
/** END TEST CASES **/
/** END TEST CASES **/

1039
ARTstor.js

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

337
ASTIS.js Normal file
View File

@ -0,0 +1,337 @@
{
"translatorID": "d4e227c0-cebb-425a-ac8d-a6625c4bfdd2",
"label": "ASTIS",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?aina\\.ucalgary\\.ca/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-04 19:44:55"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('a[href*="doi."]')) {
return "journalArticle";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('a[href*="?RECORD"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, _url) {
let DOI = ZU.cleanDOI(attr(doc, 'a[href*="doi."]', 'href'));
let search = Zotero.loadTranslator('search');
search.setHandler('translators', function (_, translators) {
search.setTranslator(translators);
search.setHandler('itemDone', function (_, item) {
item.complete();
});
search.translate();
});
search.setSearch({ DOI });
search.getTranslators();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.aina.ucalgary.ca/scripts/mwimain.dll/415/4/1?RECLIST&DATABASE=ASTIS&TM=1628105772.604",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.aina.ucalgary.ca/scripts/mwimain.dll/415/4/4/85845?RECORD&DATABASE=ASTIS",
"items": [
{
"itemType": "journalArticle",
"title": "Parasitoids indicate major climateinduced shifts in arctic communities",
"creators": [
{
"creatorType": "author",
"firstName": "Tuomas",
"lastName": "Kankaanpää"
},
{
"creatorType": "author",
"firstName": "Eero",
"lastName": "Vesterinen"
},
{
"creatorType": "author",
"firstName": "Bess",
"lastName": "Hardwick"
},
{
"creatorType": "author",
"firstName": "Niels M.",
"lastName": "Schmidt"
},
{
"creatorType": "author",
"firstName": "Tommi",
"lastName": "Andersson"
},
{
"creatorType": "author",
"firstName": "Paul E.",
"lastName": "Aspholm"
},
{
"creatorType": "author",
"firstName": "Isabel C.",
"lastName": "Barrio"
},
{
"creatorType": "author",
"firstName": "Niklas",
"lastName": "Beckers"
},
{
"creatorType": "author",
"firstName": "Joël",
"lastName": "Bêty"
},
{
"creatorType": "author",
"firstName": "Tone",
"lastName": "Birkemoe"
},
{
"creatorType": "author",
"firstName": "Melissa",
"lastName": "DeSiervo"
},
{
"creatorType": "author",
"firstName": "Katherine H. I.",
"lastName": "Drotos"
},
{
"creatorType": "author",
"firstName": "Dorothee",
"lastName": "Ehrich"
},
{
"creatorType": "author",
"firstName": "Olivier",
"lastName": "Gilg"
},
{
"creatorType": "author",
"firstName": "Vladimir",
"lastName": "Gilg"
},
{
"creatorType": "author",
"firstName": "Nils",
"lastName": "Hein"
},
{
"creatorType": "author",
"firstName": "Toke T.",
"lastName": "Høye"
},
{
"creatorType": "author",
"firstName": "Kristian M.",
"lastName": "Jakobsen"
},
{
"creatorType": "author",
"firstName": "Camille",
"lastName": "Jodouin"
},
{
"creatorType": "author",
"firstName": "Jesse",
"lastName": "Jorna"
},
{
"creatorType": "author",
"firstName": "Mikhail V.",
"lastName": "Kozlov"
},
{
"creatorType": "author",
"firstName": "JeanClaude",
"lastName": "Kresse"
},
{
"creatorType": "author",
"firstName": "DonJean",
"lastName": "LeandriBreton"
},
{
"creatorType": "author",
"firstName": "Nicolas",
"lastName": "Lecomte"
},
{
"creatorType": "author",
"firstName": "Maarten",
"lastName": "Loonen"
},
{
"creatorType": "author",
"firstName": "Philipp",
"lastName": "Marr"
},
{
"creatorType": "author",
"firstName": "Spencer K.",
"lastName": "Monckton"
},
{
"creatorType": "author",
"firstName": "Maia",
"lastName": "Olsen"
},
{
"creatorType": "author",
"firstName": "JoséeAnne",
"lastName": "Otis"
},
{
"creatorType": "author",
"firstName": "Michelle",
"lastName": "Pyle"
},
{
"creatorType": "author",
"firstName": "Ruben E.",
"lastName": "Roos"
},
{
"creatorType": "author",
"firstName": "Katrine",
"lastName": "Raundrup"
},
{
"creatorType": "author",
"firstName": "Daria",
"lastName": "Rozhkova"
},
{
"creatorType": "author",
"firstName": "Brigitte",
"lastName": "Sabard"
},
{
"creatorType": "author",
"firstName": "Aleksandr",
"lastName": "Sokolov"
},
{
"creatorType": "author",
"firstName": "Natalia",
"lastName": "Sokolova"
},
{
"creatorType": "author",
"firstName": "Anna M.",
"lastName": "Solecki"
},
{
"creatorType": "author",
"firstName": "Christine",
"lastName": "Urbanowicz"
},
{
"creatorType": "author",
"firstName": "Catherine",
"lastName": "Villeneuve"
},
{
"creatorType": "author",
"firstName": "Evgenya",
"lastName": "Vyguzova"
},
{
"creatorType": "author",
"firstName": "Vitali",
"lastName": "Zverev"
},
{
"creatorType": "author",
"firstName": "Tomas",
"lastName": "Roslin"
}
],
"date": "11/2020",
"DOI": "10.1111/gcb.15297",
"ISSN": "1354-1013, 1365-2486",
"issue": "11",
"journalAbbreviation": "Glob Change Biol",
"language": "en",
"libraryCatalog": "DOI.org (Crossref)",
"pages": "6276-6295",
"publicationTitle": "Global Change Biology",
"url": "https://onlinelibrary.wiley.com/doi/10.1111/gcb.15297",
"volume": "26",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

File diff suppressed because one or more lines are too long

384
Access Engineering.js Normal file
View File

@ -0,0 +1,384 @@
{
"translatorID": "d120a8a7-9d45-446e-8c18-ad9ef0a6bf47",
"label": "Access Engineering",
"creator": "Vinoth K - highwirepress.com",
"target": "^https?://www\\.accessengineeringlibrary\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-09-09 09:42:36"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2020-2021 Vinoth K - highwirepress.com
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
let title = attr(doc, 'meta[name="citation_title"]', 'content');
if (title) {
if (doc.querySelector('meta[name="citation_isbn"]')) {
let bookTitle = attr(doc, 'meta[name="citation_book_title"]', 'content');
if (!bookTitle || title == bookTitle) {
return "book";
}
else {
return "bookSection";
}
}
else if (url.includes('content/video/')) {
return 'videoRecording';
}
else {
return "journalArticle";
}
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.results-item a[href]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
// Missing editions for books and books chapter page
// Removed html element in abstract for video and tutorial page
// Author not updating in metatag correctly from data and read
// client advised to split and handled through custom data attr/obj
// - so we'll fill those in manually.
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
// Edition
let edition = ZU.xpathText(doc, '//meta[@name="citation_edition"]/@content');
if (edition) item.edition = edition;
// Author
// Some of old pages not having firstname, lastname seperation in markup and ignore if not
let author = doc.querySelectorAll("ul.contributor-list > [data-firstnames]");
item.creators = [];
for (let i = 0; i < author.length; i++) {
let creatorData = author[i].dataset;
item.creators.push({
firstName: creatorData.firstnames,
lastName: creatorData.surname,
creatorType: creatorData.authortype
});
}
// Abstract
let abstractNote = ZU.xpathText(doc, '//meta[@name="citation_abstract"]/@content');
if (abstractNote) item.abstractNote = ZU.cleanTags(abstractNote);
item.complete();
});
translator.getTranslatorObject(function (trans) {
// Detect web not get trigger for scape EM translator
// - so wll fill those in manually.
trans.itemType = detectWeb(doc, url);
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/book/9781259860225",
"items": [
{
"itemType": "book",
"title": "Handbook of Environmental Engineering",
"creators": [
{
"firstName": "Rao Y.",
"lastName": "Surampalli",
"creatorType": "editor"
},
{
"firstName": "Tian C.",
"lastName": "Zhang",
"creatorType": "editor"
},
{
"firstName": "Satinder Kaur",
"lastName": "Brar",
"creatorType": "editor"
},
{
"firstName": "Krishnamoorthy",
"lastName": "Hegde",
"creatorType": "editor"
},
{
"firstName": "Rama",
"lastName": "Pulicharla",
"creatorType": "editor"
},
{
"firstName": "Mausam",
"lastName": "Verma",
"creatorType": "editor"
}
],
"date": "2018",
"ISBN": "9781259860225",
"abstractNote": "A complete guide to environmental regulations and remediation.This practical resource offers thorough coverage of current environmental issues and policies along with step-by-step remediation procedures. With contributions from dozens of industry-recognized experts, Handbook of Environmental Engineering features information on all segments of the market—including water and air quality and hazardous waste—and enables you to ensure compliance with all applicable regulations. You will get details about sensors, monitoring, and toxicity treatment and controls as well as waste management and safe disposal. Real-world examples demonstrate how to apply techniques and achieve compliance, while environmental impact assessments and measurement data enhance the book9s utility.Coverage includes:• Environmental legislation• Environmental impact assessments• Air pollution control and management• Potable water treatment• Wastewater treatment and reuse• Solid waste management• Hazardous waste management• Emerging wastes in the environment• Environmental monitoring and measurements",
"edition": "1st Edition",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"publisher": "McGraw-Hill Education",
"url": "https://www.accessengineeringlibrary.com/content/book/9781259860225",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/book/9781259860225/toc-chapter/chapter3/section/section1",
"items": [
{
"itemType": "bookSection",
"title": "CHAPTER PRELIMINARIES",
"creators": [
{
"firstName": "Ashok",
"lastName": "Kumar",
"creatorType": "author"
},
{
"firstName": "Hamid",
"lastName": "Omidvarborna",
"creatorType": "author"
},
{
"firstName": "Rao Y.",
"lastName": "Surampalli",
"creatorType": "editor"
},
{
"firstName": "Tian C.",
"lastName": "Zhang",
"creatorType": "editor"
},
{
"firstName": "Satinder Kaur",
"lastName": "Brar",
"creatorType": "editor"
},
{
"firstName": "Krishnamoorthy",
"lastName": "Hegde",
"creatorType": "editor"
},
{
"firstName": "Rama",
"lastName": "Pulicharla",
"creatorType": "editor"
},
{
"firstName": "Mausam",
"lastName": "Verma",
"creatorType": "editor"
}
],
"date": "2018",
"ISBN": "9781259860225",
"abstractNote": "A complete guide to environmental regulations and remediation.This practical resource offers thorough coverage of current environmental issues and policies along with step-by-step remediation procedures. With contributions from dozens of industry-recognized experts, Handbook of Environmental Engineering features information on all segments of the market—including water and air quality and hazardous waste—and enables you to ensure compliance with all applicable regulations. You will get details about sensors, monitoring, and toxicity treatment and controls as well as waste management and safe disposal. Real-world examples demonstrate how to apply techniques and achieve compliance, while environmental impact assessments and measurement data enhance the book's utility.Coverage includes:• Environmental legislation• Environmental impact assessments• Air pollution control and management• Potable water treatment• Wastewater treatment and reuse• Solid waste management• Hazardous waste management• Emerging wastes in the environment• Environmental monitoring and measurements",
"bookTitle": "Handbook of Environmental Engineering",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"publisher": "McGraw-Hill Education",
"url": "https://www.accessengineeringlibrary.com/content/book/9781259860225/toc-chapter/chapter3/section/section1",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/video/V4005352521001",
"items": [
{
"itemType": "videoRecording",
"title": "123D Design: Cut Text Through a Plane",
"creators": [],
"date": "2014",
"abstractNote": "This video shows how to cut text through a plane with Combine/Subtract.",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"shortTitle": "123D Design",
"studio": "McGraw-Hill Education",
"url": "https://www.accessengineeringlibrary.com/content/video/V4005352521001",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/calculator/S0071_Basic_Transformer_Calculations",
"items": [
{
"itemType": "journalArticle",
"title": "Basic Transformer Calculations",
"creators": [
{
"firstName": "Bhagyalakshmi",
"lastName": "Kerekare",
"creatorType": "author"
}
],
"date": "2022/06/25/",
"abstractNote": "This Excel workbook contains four worksheets. The first worksheet covers the basic concepts of single phase transformer such as turns ratio, primary current, secondary current, primary voltage, secondary voltage, and transformer ratio calculations. The second worksheet covers the basic concepts of power, efficiency, primary/secondary EMF and transformer rating calculations. The third worksheet covers the basic concepts of three phase transformers, highlighting the star and delta connections. Calculations are done for phase voltage, phase current, line voltage, and line current for star and delta connections. The fourth worksheet covers the basic concepts kVA Ratings, 3-phase primary, and secondary full load current 3-phase voltage calculations.",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"url": "https://www.accessengineeringlibrary.com/content/calculator/S0071_Basic_Transformer_Calculations",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/case-study/CS0004_Atrial_Fibrillation",
"items": [
{
"itemType": "journalArticle",
"title": "Atrial Fibrillation: Improving Therapy via Engineering Advancements",
"creators": [
{
"firstName": "Michael J.",
"lastName": "Rust",
"creatorType": "author"
}
],
"date": "2020-04-23",
"abstractNote": "This case will explore atrial fibrillation from several perspectives, including the underlying physiology, clinical relevance, and instrumentation used for diagnosis and therapy. Students will identify and investigate unmet clinical needs that led to recent developments in technologies to treat atrial fibrillation.",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"shortTitle": "Atrial Fibrillation",
"url": "https://www.accessengineeringlibrary.com/content/case-study/CS0004_Atrial_Fibrillation",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/content/tutorial/T0004_Partially_Full_Pipe_Flow_Calculations_Using_Excel_Spreadsheets",
"items": [
{
"itemType": "journalArticle",
"title": "Partially Full Pipe Flow Calculations Using Excel Spreadsheets",
"creators": [
{
"firstName": "Harlan H.",
"lastName": "Bengtson",
"creatorType": "author"
}
],
"date": "2014/02/01/",
"abstractNote": "This tutorial provides discussion of, and illustration by, examples for use of an Excel spreadsheet for making a variety of calculations for the flow of water in a partially full circular pipe using the Manning Equation. Equations for calculating area, wetted perimeter, and hydraulic radius for partially full pipe flow are included in this tutorial along with a brief review of the Manning Equation and discussion of its use to calculate a) the flow rate in a given pipe (given diameter, slope, &amp; Manning roughness) at a specified depth of flow, b) the required diameter for a specified flow rate at a target percent full in a given pipe, and c) the normal depth (depth of flow) for a specified flow rate in a given pipe. This includes presentation and discussion of the equations for the calculations, example calculations, and screenshots of spreadsheets to facilitate the calculations.",
"language": "en",
"libraryCatalog": "www.accessengineeringlibrary.com",
"url": "https://www.accessengineeringlibrary.com/content/tutorial/T0004_Partially_Full_Pipe_Flow_Calculations_Using_Excel_Spreadsheets",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessengineeringlibrary.com/search?query=&f%5B0%5D=content_type%3ABooks&f%5B1%5D=book_component%3ATitles",
"items": "multiple"
}
]
/** END TEST CASES **/

391
Access Science.js Normal file
View File

@ -0,0 +1,391 @@
{
"translatorID": "558330ca-3531-467a-8003-86cd9602cc48",
"label": "Access Science",
"creator": "Vinoth K - highwirepress.com",
"target": "^https?://www\\.accessscience\\.com/",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-10-17 20:19:39"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2023 Vinoth K - highwirepress.com
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
let title = attr(doc, 'meta[name="citation_title"]', 'content');
if (title) {
if (doc.querySelector('meta[name="citation_isbn"]')) {
let bookTitle = attr(doc, 'meta[name="citation_book_title"]', 'content');
if (!bookTitle || title == bookTitle) {
return "book";
}
else {
return "bookSection";
}
}
else if (url.includes('content/video/') || url.includes('content/video-biography')) {
return 'videoRecording';
}
else if (url.includes('content/article/')) {
return "journalArticle";
}
else if (url.includes('news') || url.includes('briefing')) {
return "magazineArticle";
}
else {
return "webpage";
}
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.search-middle-right a[href]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
// Author
// Some of video pages having old content which does not contain the
// firstname and lastname. which is binding in a single string in
// metadata tags, So those cases we were split and mapped accordingly
if (item.itemType == 'videoRecording') {
let authorName = attr(doc, 'meta[name="citation_author"]', 'content');
if (authorName) {
item.creators = [];
if (authorName.includes(',') && authorName.split(',').length > 2) {
authorName = authorName.split(',')[0];
item.creators.push(ZU.cleanAuthor(authorName, "author", false));
}
}
}
let abstractNote = attr(doc, 'meta[name="citation_abstract"]', 'content');
item.abstractNote = abstractNote && ZU.cleanTags(abstractNote);
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = detectWeb(doc, url);
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.accessscience.com/content/book/9781260452297",
"items": [
{
"itemType": "book",
"title": "Casarett & Doull's Essentials of Toxicology",
"creators": [
{
"firstName": "Curtis D.",
"lastName": "Klaassen",
"creatorType": "editor"
},
{
"firstName": "John B. Watkins",
"lastName": "Iii",
"creatorType": "editor"
}
],
"date": "2022",
"ISBN": "9781260452297",
"abstractNote": "Doody9s Core Titles for 2021!\n\nFor more than 25 years, Casarett &amp; Doull9s Toxicology: The Basic Science of Poisons has set the standard for providing thorough, academic, and authoritative information in clear and engaging ways. Distilling the major principles and concepts from that renowned text, Casarett &amp; Doull9s Essentials of Toxicology delivers an accessible and highly readable introduction to the science and clinical field of medical toxicology. The book reflects the expertise of more than 60 renowned contributors.\n\nPresented in full-color, this new edition builds on the wide success of previous editions, with extensive updates that make the book more clinically relevant to students and beginners in toxicology, pharmacology, pharmacy, and environmental sciences. Chapter-ending self-assessment Q&amp;As and other features make the learning process more effective and efficient.\n\nCasarett and Doull9s Essentials of Toxicology is organized into seven units:\n\n• General Principles of Toxicology\n\n• Disposition of Toxicants\n\n• Nonorgan-directed Toxicity\n\n• Target Organ Toxicity\n\n• Toxic Agents\n\n• Environmental Toxicology\n\n• Applications of Toxicology\n\nSuccinct, yet comprehensive, the text covers essential principles, toxicokinetics, how toxic effects are passed on to succeeding generations, how each body system responds to poisons, and the specific effects of a wide range of toxic agents—from pesticides to radiation.",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"publisher": "McGraw Hill",
"url": "https://www.accessscience.com/content/book/9781260452297",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/book/9781260452297/chapter/chapter2",
"items": [
{
"itemType": "bookSection",
"title": "Principles of Toxicology",
"creators": [
{
"firstName": "Lauren M.",
"lastName": "Aleksunes",
"creatorType": "author"
},
{
"firstName": "David L.",
"lastName": "Eaton",
"creatorType": "author"
},
{
"firstName": "Curtis D.",
"lastName": "Klaassen",
"creatorType": "editor"
},
{
"firstName": "John B. Watkins",
"lastName": "Iii",
"creatorType": "editor"
}
],
"date": "2022",
"ISBN": "9781260452297",
"bookTitle": "Casarett & Doull's Essentials of Toxicology",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"publisher": "McGraw Hill",
"url": "https://www.accessscience.com/content/book/9781260452297/chapter/chapter2",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/video/V2537194263001",
"items": [
{
"itemType": "videoRecording",
"title": "Supplementary Problem 10.12",
"creators": [
{
"firstName": "Rebecca B.",
"lastName": "DeVasher",
"creatorType": "author"
}
],
"date": "2013",
"abstractNote": "This video details a problem involving unit cells and the calculation of the mass of a cell, length of a cell and radius of an atom in the unit cell based on the density of a solid.",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"studio": "McGraw Hill",
"url": "https://www.accessscience.com/content/video/V2537194263001",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/video-biography/VB0014",
"items": [
{
"itemType": "videoRecording",
"title": "Anderson, John R.",
"creators": [],
"date": "2011",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"studio": "McGraw Hill",
"url": "https://www.accessscience.com/content/video-biography/VB0014",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/article/a694300?implicit-login=true",
"items": [
{
"itemType": "journalArticle",
"title": "3D printing",
"creators": [
{
"firstName": "Wenchao",
"lastName": "Zhou",
"creatorType": "author"
}
],
"date": "2023",
"DOI": "10.1036/1097-8542.694300",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"url": "https://www.accessscience.com/content/article/a694300",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/news/aSN2301171?implicit-login=true",
"items": [
{
"itemType": "magazineArticle",
"title": "These chemists cracked the code to long-lasting Roman concrete",
"creators": [
{
"firstName": "Carolyn",
"lastName": "Gramling",
"creatorType": "author"
}
],
"date": "2023",
"extra": "DOI: 10.1036/1097-8542.SN0000000",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"url": "https://www.accessscience.com/content/news/aSN2301171",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/video/an600010",
"items": [
{
"itemType": "videoRecording",
"title": "Henrietta Leavitt: The Woman Who Measured the Universe",
"creators": [],
"abstractNote": "Born in 1868, Henrietta Leavitt was an astronomer ahead of her time, whose work helped to revolutionize our understanding of the universe. While working at Harvard Observatory, Leavitt began to study stars of fluctuating brightness. This video describes her crucial observation about variable stars, which gave astronomers a new way to measure distances, ultimately leading to such impactful discoveries as the expansion of the universe.\n\nCredit: ESA Hubble Videos; Hubblecast 116: Henrietta Leavitt — ahead of her time; Directed by: Mathias Jäger; Visual design and editing: Martin Kornmesser; Written by: Sara Rigby; Narration: Sara Mendes da Costa; Images: ESA/Hubble and NASA, ESO, Hubble Heritage Team (STScI/AURA), Library of Congress Prints and Photographs Division Washington, Harvard College Observatory, Huntington Library, California Institute of Technology, Digitized Sky Survey 2, M. Kornmesser, R. Gendler, Arnold Reinhold, Davide De Martin; Videos: NASA, ESA, M. Kornmesser, Luis Calcada; Music: Johan B. Monell; Web and technical support: Mathias André and Raquel Yumi Shida; Executive producer: Lars Lindberg Christensen",
"language": "en",
"libraryCatalog": "www.accessscience.com",
"shortTitle": "Henrietta Leavitt",
"studio": "McGraw Hill",
"url": "https://www.accessscience.com/content/video/an600010",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/content/biography/m0073908",
"items": [
{
"itemType": "webpage",
"title": "Abbe, Cleveland (18381916)",
"creators": [],
"language": "en",
"url": "https://www.accessscience.com/content/biography/m0073908",
"websiteTitle": "McGraw Hill's AccessScience",
"websiteType": "text",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.accessscience.com/search?query=&items_per_page=10",
"items": "multiple"
}
]
/** END TEST CASES **/

405
Adam Matthew Digital.js Normal file
View File

@ -0,0 +1,405 @@
{
"translatorID": "0701696c-3523-47ba-9617-b04eee03b6ba",
"label": "Adam Matthew Digital",
"creator": "Abe Jellinek",
"target": "^https?://www\\.([^.]+)\\.amdigital\\.co\\.uk/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-10-21 05:00:48"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.includes('/DocumentDetails.aspx') // older collections
|| url.includes('/DocumentDetailsSearch.aspx')) {
return 'manuscript';
}
if (url.includes('/Documents/Details/') // newer collections
|| url.includes('/Documents/SearchDetails')) {
return getTypeNew(doc);
}
if (getSearchResults(doc, true)) {
return "multiple";
}
else if (doc.querySelector('.DocumentsList')) {
Z.monitorDOMChanges(doc.querySelector('.DocumentsList'));
}
return false;
}
function getTypeNew(doc) {
let type = text(doc, 'tr[data-field-name="Document Type"] td[data-field-role="value"]');
if (!type) {
if (doc.body.classList.contains('cinema')) {
return 'videoRecording';
}
else {
return 'document';
}
}
type = ZU.trimInternal(type).toLowerCase();
if (type.includes('book')) {
return 'book';
}
if (type.includes('manuscript')) {
return 'manuscript';
}
if (type.includes('drawing') || type.includes('illustration')
|| type.includes('photograph')) {
return 'artwork';
}
if (type.includes('map')) {
return 'map';
}
if (type.includes('correspondence')) {
return 'letter';
}
return 'document';
}
function getSearchResults(doc, checkOnly) {
const items = {};
let found = false;
const rows = doc.querySelectorAll(
'.contentsList .tableRow .descriptionCell a, .SearchList tbody .title a, .DocumentsList tbody .title a');
for (const row of rows) {
const href = row.href;
const title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
if (url.includes('/Documents/')) {
// newer collections (served with HTTPS, no .aspx pages) have a
// completely different, and much easier to parse, structure
scrapeNew(doc, url);
}
else {
scrapeOld(doc, url);
}
}
function scrapeNew(doc, url) {
function fromTable(fieldName) {
return text(doc, `tr[data-field-name="${fieldName}"] td[data-field-role="value"]`);
}
let item = new Zotero.Item(getTypeNew(doc));
item.title = fromTable('Title');
item.abstractNote = fromTable('Abstract') || fromTable('Additional Information');
item.date = ZU.strToISO(fromTable('Date'));
item.place = fromTable('Places');
item.rights = fromTable('Copyright');
item.publisher = fromTable('Publisher');
item.language = fromTable('Language');
item.creators = fromTable('Names')
.split('; ')
.map(name => ZU.cleanAuthor(name, 'author', true));
let director = fromTable('Director');
if (director) {
item.creators.push(ZU.cleanAuthor(director, 'director', true));
}
let pageSelect = doc.querySelector('#DownloadPageFrom');
if (pageSelect) {
item.numPages = pageSelect.childElementCount;
}
item.archive = fromTable('Library/Archive') || fromTable('Collection');
item.archiveLocation = fromTable('Reference');
item.libraryCatalog = extractCatalogName(doc.title);
item.url = url.replace('/SearchDetails/', '/Details/')
.replace('?SessionExpired=True', '');
if (item.itemType != 'videoRecording') {
item.attachments.push({
title: "Full Text PDF",
mimeType: 'application/pdf',
url: attr(doc, 'a[href*="/FullDownload"]', 'href')
});
}
item.tags = [...doc.querySelectorAll('tr[data-field-name="Subjects"] td[data-field-role="value"] a')]
.map(el => ({ tag: el.textContent }));
item.complete();
}
function scrapeOld(doc, url) {
function fromTable(selector) {
return text(doc, selector + ' > .detCol2') || text(doc, selector);
}
let item = new Zotero.Item('manuscript');
item.title = fromTable('#Body_DocumentDetailsMeta_descSpan')
|| fromTable('#Body_descriptionElement');
let abstract = doc.querySelector('#Body_DocumentDetailsMeta_notesElement>.detCol2, #Body_notesElement>.detCol2');
item.abstractNote = abstract ? abstract.innerText : "";
item.date = ZU.strToISO(fromTable('#Body_DocumentDetailsMeta_dateElement'));
let pageSelect = doc.querySelector('.pageRangeSelect'); // either will do
if (pageSelect) {
item.numPages = pageSelect.childElementCount;
}
item.archive = fromTable('#Body_DocumentDetailsMeta_sourceElement');
let box = fromTable('#Body_DocumentDetailsMeta_boxElement')
|| fromTable('#Body_boxElement');
let folder = fromTable('#Body_DocumentDetailsMeta_folderElement')
|| fromTable('#Body_folderElement');
item.archiveLocation = `Box ${box}, folder ${folder}`;
item.libraryCatalog = extractCatalogName(doc.title);
item.attachments.push({
title: "Full Text PDF",
mimeType: 'application/pdf',
url: attr(doc, '.downloadPDFLink > a', 'href')
});
// we want a URL without any search strings, navigation data, etc
item.url = url.replace(/\?.*(documentid=[^&]+).*/, '?$1');
item.complete();
}
/**
* get the site's name by taking everything after the first segment of the title:
* "Search Results - Jewish Life in America - Adam Matthew Digital"
* becomes "Jewish Life in America - Adam Matthew Digital"
*/
function extractCatalogName(title) {
return title.substring(title.indexOf('-') + 2);
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetailsSearch.aspx?documentid=289906&prevPos=289906&vpath=SearchResults&searchmode=true&pi=1",
"items": [
{
"itemType": "manuscript",
"title": "Manuscript notebook of poems",
"creators": [],
"abstractNote": "Page\n\n1 'The New Colossus'\n\n2 'Progress and Poverty'\n\n3 'Venus of the Louvre'\n\n4 'Destiny I'\n\n5 'Destiny II'\n\n6 'Influence'\n\n7 'Success'\n\n8-11 'Chopin I, II, III, IV'\n\n12 'With a Copy of Don Quixote'\n\n13 'To F.P.'\n\n14 'One Augur to Another'\n\n15 'Cranes of Ibicus'\n\n16 'Reconciliation'\n\n17 'Incident at Sea' 18 'Will O' the Wisp'\n\n19 'Assurance'\n\n20 'Echoes'\n\n21 'St. Michael's Chapel'\n\n22-23 'Under the Sea. I, II'\n\n24 'Taming of the Falcon'\n\n25 'Supreme Sacrifice'\n\n26 'Life and Art'\n\n27 'Sympathy'\n\n28 'Dreaming Castle'\n\n29 'To R.W.E.'\n\n30-37 'Symphonic Studies (after Robert Schumann). Prelude, I, II, III, IV, V, VI Epilogue'\n\n38 'City Visions'\n\n40 'Long Island Sound'\n\n41-49 Translated Sonnets:\n\nPage 41 'Art the Redeemer'\n\nPage 42 'From the French of Fran<61>ois Copp<70>'\n\nPages 44-49 'Six Sonnets from the Studies of Petrarch, a. 'In Vita LXVII', b. 'In Vita LXXVI', c. 'In Morte XLIII', d. 'In Morte II. On the Death of Cardinal Colonna and Laura', e. 'In Vita CIX', f. 'In Vita, CV'\n\n50 '1492'\n\n51 'Restlessness'\n\n52 'Child at the Bath. R. de K. G.'\n\n54 'Autumn Sadness'\n\n56 'Song. Venus'\n\n57 'From the Arabian Nights'\n\n58 'Reed Song'\n\n59 'Moonlight, from German of Eichendorff'\n\n60 'Songs from Eichendroff'\n\n61 'Lida and the Swan. Faust. Part II. Act II. Scene 2'\n\n62-72 'Phaon'\n\n73 'To the Moon after Sunrise'\n\n75-79 'Fragments from Petrarch'\n\nPage 75 'Canzone XII. 5'\n\nPage 76 'Trionfo Della Morte'\n\nPage 77 'Trionfo D'Amore'\n\nPage 78 'Triumph of Death'\n\n80 'Sunrise'\n\n85 'To Nelly [?] Sleeping'\n\n89-97 'The Creation of Man. Miwk [Mohawk] Fable'\n\n98-105 'The New Cupid. From the German of Goethe'\n\n106-111 'August Moon'\n\n112-115 'My Goddess. From the German of Goethe'\n\n116-119 'The Old Year-1883. Affectionately dedicated to W.S.P. & W.A.P.'\n\n120 'Ariel and Euphorion' [clippings pasted into notebook, unknown journal]\n\n122 'Don Rafael' [clippings pasted into notebook, unknown journal]\n\n122 'Two Sonnets' [clippings pasted into notebook, unknown journal]: 'Sonnet I. Petrarch: To a Friend', 'Sonnet II. Art, the Redeemer'\n\n123 'The New Ezekiel' [clippings pasted into notebook, unknown journal]\n\n123 'The Choice' [clippings pasted into notebook, for The American Hebrew]\n\n123 'The Supreme Sacrifice' [clippings pasted into notebook, for The American Hebrew]\n\n123 'Zulieka. Translated from Goethe's 'West Gestliche Divan' [clippings pasted into notebook, unknown journal, most possibly in Jewish Messenger]\n\n124 'The World's Justice' [clippings pasted into notebook, unknown journal]\n\n124 'The Feast of Lights' [clippings pasted into notebook, for The American Hebrew]\n\n126-130 'Grotesque'\n\n131-136 'Translations from Copp<70>'\n\n137-149 ['By the Waters of Babylon'] 'Little Poems in Prose:\n\nPage 137 'I. The Exodus'\n\nPage 140 'II. Treasures'\n\nPage 141 'III. The Sower'\n\nPage 143 'IV. The Test'\n\nPage 144 'V. The Prophet'\n\nPage 146-147 Pages are blank in the original\n\nPage 148 'VI. Currents'\n\nPage 149 'VII. Chrysalis'\n\n150 'Gifts'\n\n152 'A Masque of Venice'\n\n156 'To Carmen Sylva'\n\n[Page 156 is followed by 159, with no gaps in poetry]\n\n161-163 'In a Gothic Church' (never completed).",
"archive": "American Jewish Historical Society",
"archiveLocation": "Box 1, folder 2",
"libraryCatalog": "Jewish Life in America - Adam Matthew Digital",
"numPages": 165,
"url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetailsSearch.aspx?documentid=289906",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetails.aspx?documentid=288444&prevPos=288444&filter=0%7c1%7c2&vpath=contents&pi=1",
"items": [
{
"itemType": "manuscript",
"title": "Baron de Hirsch Fund colonies and schools",
"creators": [],
"abstractNote": "See also P19/OS1/2",
"archiveLocation": "Box 3, folder 2",
"libraryCatalog": "Jewish Life in America - Adam Matthew Digital",
"numPages": 38,
"url": "http://www.jewishlife.amdigital.co.uk/Contents/DocumentDetails.aspx?documentid=288444",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.jewishlife.amdigital.co.uk/Contents/Default.aspx?filter=1%7c0",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.gender.amdigital.co.uk/Documents/Details/Etiquette%20for%20Ladies%20and%20Gentlemen%20London%201876?SessionExpired=True",
"items": [
{
"itemType": "book",
"title": "Etiquette for Ladies and Gentlemen",
"creators": [],
"date": "1876",
"archive": "Bodleian Library, University of Oxford",
"archiveLocation": "268 c.457",
"libraryCatalog": "Defining Gender - Adam Matthew Digital",
"numPages": 65,
"publisher": "Frederick Warne and Co.",
"url": "https://www.gender.amdigital.co.uk/Documents/Details/Etiquette%20for%20Ladies%20and%20Gentlemen%20London%201876",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.americanwest.amdigital.co.uk/Documents/Details/Graff_2445",
"items": [
{
"itemType": "document",
"title": "$150 reward. Whereas a robbery was committed in the vicinity of the town of Fort Madison, on the 22d Inst….",
"creators": [
{
"firstName": "Jacob",
"lastName": "Guy",
"creatorType": "author"
},
{
"firstName": "Jacob",
"lastName": "Bowers",
"creatorType": "author"
},
{
"firstName": "W. Braxton",
"lastName": "Gillock",
"creatorType": "author"
}
],
"date": "1840",
"archive": "Everett D. Graff Collection of Western Americana",
"archiveLocation": "Graff 2445",
"libraryCatalog": "American West - Adam Matthew Digital",
"url": "https://www.americanwest.amdigital.co.uk/Documents/Details/Graff_2445",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.socialismonfilm.amdigital.co.uk/Documents/Details/BFI_ETV_Advance_Democracy_25SD_Prores-4?SessionExpired=True#MediaSummary",
"items": [
{
"itemType": "videoRecording",
"title": "Advance Democracy",
"creators": [
{
"firstName": "Ralph",
"lastName": "Bond",
"creatorType": "director"
}
],
"abstractNote": "Starts with a discussion of inequality in London contrasting the rich with the lives of the poor. Features the hard lives of dock workers and a semi-dramatization of them complaining about taxes and their uses to fight wars. A wife talks to her husband about the merits of the Co-operative, and the husband later listens to a speech about democracy and the co-operative movement which mentions the sacrifices of the Tolpuddle Martyrs, the Chartists and the Rochdale Equitable Pioneers. Warns of the dangers of Nazis (with archive footage of Hitler and war). The protagonist of the film is won over and mobilises his colleagues to march on May Day. Features a medley of labour movement songs.",
"language": "English (Dialogue)",
"libraryCatalog": "Socialism on Film: The Cold War and International Propaganda - Adam Matthew Digital",
"place": "United Kingdom  London",
"rights": "The British Film Institute",
"url": "https://www.socialismonfilm.amdigital.co.uk/Documents/Details/BFI_ETV_Advance_Democracy_25SD_Prores-4#MediaSummary",
"attachments": [],
"tags": [
{
"tag": "Co-operatives"
},
{
"tag": "Family"
},
{
"tag": "Industry"
},
{
"tag": "Music"
},
{
"tag": "Politics"
},
{
"tag": "Ships and shipping"
},
{
"tag": "Shopping"
},
{
"tag": "Social class"
},
{
"tag": "Trade unions"
},
{
"tag": "Women"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

309
Ahval News.js Normal file
View File

@ -0,0 +1,309 @@
{
"translatorID": "64f4a2b8-33d8-4303-834a-3b71065cf6c6",
"label": "Ahval News",
"creator": "Abe Jellinek",
"target": "^https?://ahvalnews\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-12 20:49:38"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (getJSONLD(doc)) {
return "newspaperArticle";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h2.field-title > a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, _url) {
let item = new Zotero.Item('newspaperArticle');
let json = getJSONLD(doc);
item.title = json.headline;
item.abstractNote = json.description;
item.publicationTitle = 'Ahval';
item.date = ZU.strToISO(json.dateModified || json.datePublished);
item.section = json.articleSection;
item.language = doc.documentElement.lang;
item.url = json.url;
if (json.author && json.author.name != 'Ahval') {
// usually no authors, sometimes one
item.creators.push(ZU.cleanAuthor(json.author.name, 'author'));
}
item.attachments.push({
title: 'Snapshot',
document: doc
});
item.complete();
}
function getJSONLD(doc) {
let jsonLDText = text(doc, 'script[type="application/ld+json"]');
if (!jsonLDText.trim()) {
return null;
}
let json = JSON.parse(jsonLDText);
if (!json['@graph']) {
return null;
}
for (let graphObj of json['@graph']) {
if (graphObj['@type'] == 'NewsArticle') {
return graphObj;
}
}
return null;
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea",
"items": [
{
"itemType": "newspaperArticle",
"title": "Turkey signs $2 billion currency swap deal with South Korea",
"creators": [],
"date": "2021-08-12",
"abstractNote": "Turkeys central bank and the Bank of Korea signed a currency swap agreement in lira and won worth as much as $2 billion.\r\n\r\nThe deal, effective for three years from Thursday, is designed to promote bilateral trade and financial cooperation for the economic development of both countries, the Bank of Korea said in a statement on its website.\r\n\r\nTurkey has sought to obtain currency swaps with central banks around the world to help bolster its foreign exchange reserves, which have fallen into negative territory when accounting for liabilities. The agreements, which have included arrangements worth about $10 billion with Turkeys regional ally Qatar, have failed to halt a slide in the liras value to successive record lows since a 2018 currency crisis.\r\n\r\nIt is interesting that “another G20 central bank seems willing to support and prolong the continuation of really questionable monetary policy settings in Turkey”, said Tim Ash, a senior emerging markets strategist at BlueBay Asset Management in London. The deal \"does not really touch the sides\" in terms of defending the lira, he said.\r\n\r\nTurkeys central bank kept interest rates at below inflation for much of last year to help the government engineer a borrowing boom. That led to an exodus of capital from the lira as deposit holders saw returns from their investments, net of inflation, disappear.\r\n\r\nThe lira rose 0.3 percent to 8.6 per dollar after the swap deal was announced after trading up 0.1 percent earlier in the day.\r\n\r\nThe agreement with the Bank of Korea was announced hours before the Turkish central bank was due to publish a monthly decision on interest rates. The benchmark rate in Turkey stands at 19 percent, marginally above annual consumer price inflation of 18.95 percent.\r\n\r\nPresident Recep Tayyip Erdoğan is calling for rate cuts and has sacked three central bank governors in just over two years due to disagreements over monetary policy. Erdoğan holds the unorthodox view that higher interest rates are inflationary. The latest governor, appointed in March, has kept rates unchanged even as inflation accelerated from 15.6 percent in February.\r\n\r\nSouth Korean companies make substantial investments in Turkeys economy, particularly in the construction, energy and technology industries. The investments have included a 2017 contract for the building of the worlds longest suspension bridge over the Dardanelles straits worth around $2.7 billion.",
"language": "en",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "News",
"url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/northern-cyprus-turkey/former-turkish-cypriot-leader-akincis-adviser-banned-entering-turkey",
"items": [
{
"itemType": "newspaperArticle",
"title": "Former Turkish Cypriot leader Akıncıs adviser banned from entering Turkey",
"creators": [
{
"firstName": "Tümay",
"lastName": "Tuğyan",
"creatorType": "author"
}
],
"date": "2021-07-13",
"abstractNote": "Ali Bizden, the press and communications coordinator of former Turkish Cypriot leader Mustafa Akıncı, was banned from entering Turkey for five years on charges of acting against the countrys national security.\r\n\r\nBizden was informed of the ban by immigration police in Turkey on Tuesday night after he sought to pass through passport control at Istanbuls Sabiha Gökçen Airport. The ban had been ordered back in September last year, he said via social media on Wednesday.",
"language": "en",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "News",
"url": "https://ahvalnews.com/northern-cyprus-turkey/former-turkish-cypriot-leader-akincis-adviser-banned-entering-turkey",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea",
"items": [
{
"itemType": "newspaperArticle",
"title": "Turkey signs $2 billion currency swap deal with South Korea",
"creators": [],
"date": "2021-08-12",
"abstractNote": "Turkeys central bank and the Bank of Korea signed a currency swap agreement in lira and won worth as much as $2 billion.\r\n\r\nThe deal, effective for three years from Thursday, is designed to promote bilateral trade and financial cooperation for the economic development of both countries, the Bank of Korea said in a statement on its website.\r\n\r\nTurkey has sought to obtain currency swaps with central banks around the world to help bolster its foreign exchange reserves, which have fallen into negative territory when accounting for liabilities. The agreements, which have included arrangements worth about $10 billion with Turkeys regional ally Qatar, have failed to halt a slide in the liras value to successive record lows since a 2018 currency crisis.\r\n\r\nIt is interesting that “another G20 central bank seems willing to support and prolong the continuation of really questionable monetary policy settings in Turkey”, said Tim Ash, a senior emerging markets strategist at BlueBay Asset Management in London. The deal \"does not really touch the sides\" in terms of defending the lira, he said.\r\n\r\nTurkeys central bank kept interest rates at below inflation for much of last year to help the government engineer a borrowing boom. That led to an exodus of capital from the lira as deposit holders saw returns from their investments, net of inflation, disappear.\r\n\r\nThe lira rose 0.3 percent to 8.6 per dollar after the swap deal was announced after trading up 0.1 percent earlier in the day.\r\n\r\nThe agreement with the Bank of Korea was announced hours before the Turkish central bank was due to publish a monthly decision on interest rates. The benchmark rate in Turkey stands at 19 percent, marginally above annual consumer price inflation of 18.95 percent.\r\n\r\nPresident Recep Tayyip Erdoğan is calling for rate cuts and has sacked three central bank governors in just over two years due to disagreements over monetary policy. Erdoğan holds the unorthodox view that higher interest rates are inflationary. The latest governor, appointed in March, has kept rates unchanged even as inflation accelerated from 15.6 percent in February.\r\n\r\nSouth Korean companies make substantial investments in Turkeys economy, particularly in the construction, energy and technology industries. The investments have included a 2017 contract for the building of the worlds longest suspension bridge over the Dardanelles straits worth around $2.7 billion.",
"language": "en",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "News",
"url": "https://ahvalnews.com/turkish-lira/turkey-signs-2-billion-currency-swap-deal-south-korea",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/tr/din/secme-sacmalar-hukuk-islam-allah-kelami-vs",
"items": [
{
"itemType": "newspaperArticle",
"title": "Seçme saçmalar: Hukuk, İslam, Allah kelamı vs.",
"creators": [
{
"firstName": "Sevan",
"lastName": "Nişanyan",
"creatorType": "author"
}
],
"date": "2021-08-11",
"abstractNote": "“Laik toplumlarda kanunlar kutsal değildir. Zaman içinde insanların gelişen ihtiyaçlarına göre hukukta iyileştirme yapılabilir. Laik toplumlarda insanlar kendi yasalarını yapar, tanrı onların dünyada yaptıklarına karışmaz.”\r\n\r\nKanunları alelumum insanlar yapmaz. Birileri yapar. \r\n\r\n“Kanunlar zaman ve zemine göre değiştirilebilir” dediğiniz zaman kimin ne zaman ve hangi koşullarda değiştirebileceğini de belirtmeniz gerekir. \r\n\r\nYoksa birileri çıkar “arkadaşlar yarın beni padişah ilan edeceğiz” der, yahut gece yarısı torba yasa çıkarır, gık diyemezsin.\r\n\r\nKarşı taraf haklı mıdır, haksız mıdır ayrı mevzu. Ama laiklik hayranlarının yüz senedir halâ karşı tarafın gerekçesini fark etmemiş görünmeleri hayreti muciptir. \r\n\r\nKarşı taraf diyor ki, kanunlar kutsaldır. Yani kafana esti diye zırt pırt değiştiremezsin. O yetkiyi sana verirsek sonucu kaçınılmaz bir kesinlikle zorbalıktır, hukukun paçavra edilmesidir. Hukuku zamana uydurmak gerekiyor ise nasıl uydurulacağına devlet sopasını elinde tutanlar değil, ak sakallı alimler karar versin.\r\n\r\nAyrıca, müsterih olun, tanrı bir şeye karışmaz. \r\n\r\nÇünkü tanrı hayaldir. \r\n\r\nSadece yasa yapmanın farklı yöntemleri vardır.\r\n\r\n“Roma imparatorluğunda kanunlarla toplumda kutsal olan ve olmayan net bir şekilde ayrılmıştır. Laiklik esas alınmıştır.”\r\n\r\nBiraz Roma tarihi bilen bilir ki Roma hukuku ve siyasi kurumları iliğine kadar dini inanç ve törelerle yoğrulmuştur; dinsizliğin, dine zarar vermenin cezası ölümdür.  \r\n\r\nMerak ediyorsanız Mommsen yahut Fustel de Coulanges okuyun. \r\n\r\nEski Roma dini geniş meşrepli olduğundan insanları çok üzmemiştir. \r\n\r\nHıristiyanlık resmi din olduğunda ise muhtemelen insanlık tarihinin en feci yobazlık sahneleri yaşandı. Yanlış inanç sahipleri acımasızca kovuşturuldu, tapınakları yakıldı, dini zulümden kaçanlar yüzünden koca vilayetler ıssız kaldı.\r\n\r\nKutsal olanla dünyevinin ayrışması Batı Avrupa Ortaçağının eseridir. Roma devleti Batıda yıkılınca kilise uzun süre tek medeni otorite mercii olarak kaldı. Sonra devletler yeniden güçlenince gücünü onlarla paylaşmamak için çatır çatır direndi. \r\n\r\nSonunda otoriteyi paylaşmaktan ve birbirinin alanına fazla bulaşmamayı kabul etmekten başka çare bulamadılar.\r\n\r\nDoğu Romada devlet çökmediği için böyle bir şey olmadı. Ne Bizansta, ne Rusyada, ne Osmanlıda o yüzden din ve devletin ayrılması diye bir şey duyulmamıştır.\r\n\r\n“Kuranın tanrıdan geldiğine inanıldığından değiştirilemez özelliği vardır. Bu durumda Kurandaki toplum yönetim yasalarını, hukuku değiştirebilir misiniz? Değiştiremezsiniz.”\r\n\r\nKuranda birtakım şiirsel imgeler, muğlak deklarasyonlar, ne manaya geldiği belirsiz meseller ve bolca öfke krizi vardır. Hemen her ayetin zıddını söyleyen bir ayet illa ki bulunur. \r\n\r\nBu tuhaf metinden (ve onu tamamlamak için uydurulan on binlerce hadisten) bir hukuk sistemi kendiliğinden üremedi. Üretmek için çağın en parlak alimleri canhıraş bir gayretle 200 sene uğraştılar. Ürettikleri sistemi yorumlamak için, eskisi kadar parlak olmayan varisleri bin küsur senedir hala uğraşıyor. Siz orada değiştirilmez bir tanrı yasası bulduğunuzu iddia ediyorsanız yolunuz açık olsun.\r\n\r\nİslam hukukunun iki ana yolu ve dört tali mezhebi (ve tabii bugün terk edilmiş olan onlarca alternatifi) Abbasi devletinin ilk yüzyıllarında oluşturuldu. \r\n\r\nYani Kuranın telifinden kaba hesap 100 ila 200  yıl sonra. \r\n\r\nAllahı referans göstermeleri politik bir tercihti. Aşırı güçlenen ve meşruiyet zemini sarsak olan halife devletine karşı hukuk mesleği sırtını “Allah kelamına” dayama ihtiyacını hissetti. Buyur askeriye senin, vergi senin, ama hukuk senin tasarrufunda değil, ilmiye sınıfının tekelidir, dediler. \r\n\r\nSenin kılıcın varsa bizim de Allahımız ve kitabımız var diye kendi kendilerini teselli ettiler.\r\n\r\nSon derece akıllıca bir hamleydi. Sonuçta ilim mesleğinin yüzyıllar içinde aşırı derecede muhafazakarlaşmasına, kılıç sahibinin tasallutuna karşı istiridye gibi içine kapanmasına yol açtı, o ayrı mevzu.\r\n\r\nBugün “İslam değişir mi? Değişmez!” diyerek kendi sorup kendi cevaplayanların bu hakikatleri aklında tutmasında yarar vardır. \r\n\r\nİslam hukuku konusunda ahkam kesmeyi toplumun en cahil ve ezik sınıflarına terk edip sonra onların kalın kafalılığından şikayet etmek pek de rasyonel bir tavır olmasa gerek.\r\n\r\n\r\n* Bu yazı, Sevan Nişanyanın blogundan alınmıştır.",
"language": "tr",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "Yazarlar",
"shortTitle": "Seçme saçmalar",
"url": "https://ahvalnews.com/tr/din/secme-sacmalar-hukuk-islam-allah-kelami-vs",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/ar/70-mn-alatrak-ydwn-laghlaq-alhdwd-fy-wjh-allajyyn/alnsryt-altrkyt",
"items": [
{
"itemType": "newspaperArticle",
"title": "70% من الأتراك يدعون لإغلاق الحدود في وجه اللاجئين",
"creators": [],
"date": "2021-08-12",
"abstractNote": "اعتقلت السلطات التركية الخميس نحو ثمانين شخصا يشتبه بأنهم شجعوا أو شاركوا في الهجوم على محلات تجارية لسوريين في أنقرة على أثر مشاجرة سقط فيها قتيل في أجواء تصاعد خطاب كراهية الأجانب في تركيا.",
"language": "ar",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "أخبار",
"url": "https://ahvalnews.com/ar/70-mn-alatrak-ydwn-laghlaq-alhdwd-fy-wjh-allajyyn/alnsryt-altrkyt",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/ar/hl-ymkn-ltrkya-walhnd-ttqabla-wjhaan-lwjh-fy-afghanstan/alhnd",
"items": [
{
"itemType": "newspaperArticle",
"title": "هل يمكن لتركيا والهند أن تتقابلا وجهاً لوجه في أفغانستان؟",
"creators": [
{
"firstName": "نيكولاس",
"lastName": "مورغان",
"creatorType": "author"
}
],
"date": "2021-08-10",
"abstractNote": "لماذا ترحب #الهند بدور #تركيا في #أفغانستان بعد خروج الولايات المتحدة رغم خلافات البلدين العميقة؟",
"language": "ar",
"libraryCatalog": "Ahval News",
"publicationTitle": "Ahval",
"section": "رأي",
"url": "https://ahvalnews.com/ar/hl-ymkn-ltrkya-walhnd-ttqabla-wjhaan-lwjh-fy-afghanstan/alhnd",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ahvalnews.com/special-feature",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -2,14 +2,14 @@
"translatorID": "e317b4d4-03cf-4356-aa3c-defadc6fd10e",
"label": "Air University Journals",
"creator": "Sebastian Karcher",
"target": "https?://www\\.airuniversity\\.af\\.mil/(ASPJ|SSQ)",
"target": "https?://www\\.airuniversity\\.af\\.edu/(ASPJ|SSQ)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-12-11 22:06:13"
"lastUpdated": "2021-10-14 19:04:37"
}
/*
@ -35,15 +35,12 @@
***** END LICENSE BLOCK *****
*/
// attr()/text() v2
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
// eslint-disable-next-line no-unused-vars
function detectWeb(doc, url) {
if (text(doc, 'a[title="View Article"]', 1)) {
if (text(doc, 'a[title="View Article"], h2>a[href*="documents"]', 1)) {
return "multiple";
}
return false;
}
@ -53,39 +50,46 @@ function doWeb(doc, url) {
if (rows.length < 3) {
rows = ZU.xpath(doc, '//div[@class="da_black"]//p[span//a[@title="View Article"]]');
}
// Z.debug(rows.length);
if (!rows.length) {
// New layout, e.g. https://www.airuniversity.af.edu/SSQ/Display/Article/2748342/volume-15-issue-3-fall-2021/
rows = ZU.xpath(doc, '//div[@class="da_black"]//li//div[h2/a or h2/em/a]');
}
var items = {};
var journal, abbr, ISSN;
if (url.includes("/ASPJ/")) {
var journal = "Air & Space Power Journal";
var abbr = "ASPJ";
var ISSN = "1554-2505";
journal = "Air & Space Power Journal";
abbr = "ASPJ";
ISSN = "1554-2505";
}
else if (url.includes("/SSQ/")) {
var journal = "Strategic Studies Quarterly";
var abbr = "SSQ";
var ISSN = "1936-1815";
journal = "Strategic Studies Quarterly";
abbr = "SSQ";
ISSN = "1936-1815";
}
var voliss = text(doc, 'h1.title');
var date = text(doc, 'p.da_story_info');
for (let i = 0; i < rows.length; i++) {
var infoArray = [];
var title = text(rows[i], 'span > a[title="View Article"]');
var id = attr(rows[i], 'span > a[title="View Article"]', "id");
var id = attr(rows[i], 'span > a[title="View Article"]', "href");
if (!title) {
title = text(rows[i], 'strong > a[title="View Article"]');
id = attr(rows[i], 'strong > a[title="View Article"]', "id");
id = attr(rows[i], 'strong > a[title="View Article"]', "href");
}
if (!title) {
title = text(rows[i], 'h2 > a, h2>em>a');
id = attr(rows[i], 'h2 > a, h2>em>a', "href");
}
if (title !== null) {
items[id] = title;
}
}
Zotero.selectItems(items, function(items) {
Zotero.selectItems(items, function (items) {
// Z.debug(items);
if (!items) {
return true;
return;
}
for (let id in items) {
scrapeMultiples(doc, id, date, voliss, journal, abbr, ISSN);
@ -96,39 +100,82 @@ function doWeb(doc, url) {
function scrapeMultiples(doc, id, date, voliss, journal, abbr, ISSN) {
// Z.debug(id)
var item = new Z.Item('journalArticle');
var title = text(doc, 'span > a#' + id);
var link = attr(doc, 'span > a#' + id, "href");
var titleXpath = '//span/a[contains(@href, "' + id + '")]';
var title = ZU.xpathText(doc, titleXpath);
var link = id;
if (!title) {
title = text(doc, 'strong > a#' + id);
link = attr(doc, 'strong > a#' + id, "href");
titleXpath = '//strong/a[contains(@href, "' + id + '")]';
title = ZU.xpathText(doc, titleXpath);
link = id;
}
// Newer issues
if (!title) {
titleXpath = '//h2//a[contains(@href, "' + id + '")]';
title = ZU.xpathText(doc, titleXpath);
link = id;
}
item.title = ZU.trimInternal(title.trim());
var section = ZU.xpath(doc, '//div[@class="da_black"]/table[tbody//a[@id="' + id + '"]]');
var sectionXpath = '//div[@class="da_black"]/table[tbody//a[@href="' + id + '"]]';
var section = ZU.xpath(doc, sectionXpath);
if (!section.length) {
section = ZU.xpath(doc, '//div[@class="da_black"]/p[span//a[@id="' + id + '"]]');
sectionXpath = '//div[@class="da_black"]/p[span//a[@href="' + id + '"]]';
section = ZU.xpath(doc, sectionXpath);
}
// Newer issues
if (!section.length) {
sectionXpath = '//div[@class="da_black"]//div[h2//a[@href="' + id + '"]]';
section = ZU.xpath(doc, sectionXpath);
}
if (section.length) {
var authors = text(section[0], 'p>span>strong');
if (!authors) authors = text(section[0], 'p>strong>span');
// Newer issues
if (!authors) authors = text(section[0], 'strong');
if (authors) {
authors = ZU.trimInternal(authors.trim());
// delete name suffixes
authors = authors.replace(/, (USAF|USN|Retired|PE|LMFT)\b/g, "");
authorsList = authors.split(/\/|,?\sand\s|,\s/);
var rank = /^(By:|Adm|Rear Adm|Col|Lt Col|Brig Gen|Gen|Maj Gen \(sel\)|Maj|Capt|Maj Gen|2nd Lt|W(in)?g Cdr|Mr?s\.|Mr\.|Dr\.)\s/;
if (authors.includes("Reviewed by")) {
var reviewedAuthor = authors.match(/^by\s(.+)/);
var reviewer = authors.match(/Reviewed by\s(.+)/);
if (reviewedAuthor) {
reviewedAuthor = parseAuthors(reviewedAuthor[1], "reviewedAuthor");
}
if (reviewer) {
reviewer = parseAuthors(reviewer[1], "author");
}
for (i = 0; i < authorsList.length; i++) {
// Z.debug(authorsList[i]);
var author = authorsList[i].trim().replace(rank, "");
item.creators.push(ZU.cleanAuthor(author, "author"));
if (reviewedAuthor && reviewer) {
item.creators = reviewer.concat(reviewedAuthor);
}
else {
item.creators = reviewer || reviewedAuthor;
}
}
else {
authors = ZU.trimInternal(authors.trim());
// delete name suffixes
item.creators = parseAuthors(authors, "author");
}
}
var abstract = text(section[0], 'p > span', 2);
if (!abstract) abstract = text(section[0], 'p > span', 1);
// ASPJ
var abstract = text(section[0], 'p > span', 1);
// SSQ
if (!abstract) abstract = ZU.xpathText(section[0], './/p/span[1]/text()');
// Newer issues
if (!abstract) abstract = ZU.xpathText(section[0], './/p/text()');
if (abstract) {
item.abstractNote = ZU.trimInternal(abstract.trim());
item.abstractNote = ZU.trimInternal(abstract.trim().replace(/^,\s/, ""));
}
}
@ -156,16 +203,33 @@ function scrapeMultiples(doc, id, date, voliss, journal, abbr, ISSN) {
item.complete();
}
/** BEGIN TEST CASES **/
function parseAuthors(creators, type) {
creators = ZU.trimInternal(creators.trim());
// delete name suffixes
creators = creators.replace(/, (USAF|USN|Retired|PE|LMFT|USA|[^,]+Air Force)\b/g, "");
let creatorsList = creators.split(/\/|,?\sand\s|,\s/);
var rank = /^(By:|Adm|Rear Adm|Col|Lt Col|LTC|Brig Gen|Gen|Maj Gen \(sel\)|Maj|Capt|CAPT|Maj Gen|2nd Lt|W(in)?g Cdr|Mr?s\.|Mr\.|Dr\.)\s/;
var creatorsArray = [];
for (let creator of creatorsList) {
creator = creator.trim().replace(rank, "");
creatorsArray.push(ZU.cleanAuthor(creator, type));
}
return creatorsArray;
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.airuniversity.af.mil/SSQ/Display/Article/1261066/volume-11-issue-3-fall-2017/",
"url": "https://www.airuniversity.af.edu/SSQ/Display/Article/1261066/volume-11-issue-3-fall-2017/",
"items": "multiple"
},
{
"type": "web",
"url": "http://www.airuniversity.af.mil/ASPJ/Display/Article/1151902/volume-30-issue-2-summer-2016/",
"url": "https://www.airuniversity.af.edu/ASPJ/Display/Article/1151902/volume-30-issue-2-summer-2016/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.airuniversity.af.edu/SSQ/Display/Article/2748342/volume-15-issue-3-fall-2021/",
"items": "multiple"
}
]

484
Airiti.js

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,5 @@
{
"translatorID": "0a84a653-79ea-4c6a-8a68-da933e3b504a",
"translatorType": 4,
"label": "Alexander Street Press",
"creator": "John West and Michael Berkowitz",
"target": "^https?://(www\\.)alexanderstreet",
@ -8,45 +7,47 @@
"maxVersion": "",
"priority": 100,
"inRepository": true,
"lastUpdated": "2009-01-08 08:19:07"
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-12-28 04:42:00"
}
function detectWeb(doc, url) {
if ( url.indexOf("object.details.aspx") != -1 ) {
var zitemtype = doc.getElementById("ctl00_ctl00_MasterContentBody_ContentPlaceHolder1_txtZType").value;
switch (zitemtype.toLowerCase()) {
case "book":
return "book";
break;
case "chapter":
return "bookSection";
break;
case "journal":
return "journalArticle";
break;
case "manuscript":
return "manuscript";
break;
case "audio":
return "audioRecording";
break;
case "video":
return "videoRecording";
break;
case "issue":
return "journalArticle";
break;
case "article":
return "journalArticle";
break;
case "series":
return "interview";
break;
case "session":
return "interview";
break;
default:
return "document";
case "book":
return "book";
break;
case "chapter":
return "bookSection";
break;
case "journal":
return "journalArticle";
break;
case "manuscript":
return "manuscript";
break;
case "audio":
return "audioRecording";
break;
case "video":
return "videoRecording";
break;
case "issue":
return "journalArticle";
break;
case "article":
return "journalArticle";
break;
case "series":
return "interview";
break;
case "session":
return "interview";
break;
default:
return "document";
}
} else if (url.indexOf("results.aspx") != -1) {
return "multiple";
@ -140,39 +141,39 @@ function scrape(doc, url) {
function GetItemType(zitemtype) {
switch (zitemtype.toLowerCase()) {
case "book":
return "book";
break;
case "chapter":
return "bookSection";
break;
case "journal":
return "journalArticle";
break;
case "manuscript":
return "manuscript";
break;
case "audio":
return "audioRecording";
break;
case "video":
return "videoRecording";
break;
case "issue":
return "journalArticle";
break;
case "article":
return "journalArticle";
break;
case "series":
return "interview";
break;
case "session":
return "interview";
break;
default:
return "document";
}
case "book":
return "book";
break;
case "chapter":
return "bookSection";
break;
case "journal":
return "journalArticle";
break;
case "manuscript":
return "manuscript";
break;
case "audio":
return "audioRecording";
break;
case "video":
return "videoRecording";
break;
case "issue":
return "journalArticle";
break;
case "article":
return "journalArticle";
break;
case "series":
return "interview";
break;
case "session":
return "interview";
break;
default:
return "document";
}
}
function doWeb(doc, url) {
@ -185,13 +186,13 @@ function doWeb(doc, url) {
while (next_title = titles.iterateNext()) {
items[next_title.href] = next_title.textContent;
}
items = Zotero.selectItems(items);
for (var i in items) {
articles.push(i);
}
Zotero.selectItems(items, function (items) {
if (!items) return;
ZU.processDocuments(Object.keys(items), scrape);
});
} else {
articles = [url];
scrape(doc, url);
}
Zotero.Utilities.processDocuments(articles, scrape, function() {Zotero.done();});
}
}/** BEGIN TEST CASES **/
var testCases = []
/** END TEST CASES **/

File diff suppressed because one or more lines are too long

242
Alsharekh.js Normal file
View File

@ -0,0 +1,242 @@
{
"translatorID": "70fbaf2f-ba02-426c-8beb-4ddfbbefd14b",
"label": "Alsharekh",
"creator": "Abe Jellinek",
"target": "^https://archive\\.alsharekh\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-07-24 02:21:59"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
let apiBase = 'https://archiveapi.alsharekh.org';
let urlRe = /\/Articles\/([^/]+)\/([^/]+)\/([^/?#]+)/;
function detectWeb(doc, url) {
if (urlRe.test(url)) {
return "magazineArticle";
}
let appElem = doc.querySelector("app-root");
if (appElem) {
Z.monitorDOMChanges(appElem);
}
if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('td > a[href^="/Articles/"], th > a[href^="/Articles/"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
async function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
let items = await Z.selectItems(getSearchResults(doc));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(null, url);
}
}
else {
await scrape(doc, url);
}
}
async function scrape(doc, url) {
let item = new Zotero.Item('magazineArticle');
let [, MID, IID, AID] = url.match(urlRe);
let issue = await requestJSON(`${apiBase}/Search/IssueHInfo?MID=${MID}&IID=${IID}`);
let article = await requestJSON(`${apiBase}/Search/ArticleHInfo?AID=${AID}`);
item.title = article.articleTitle.replace(' : ', ": ");
item.pages = article.pageNo;
item.creators.push(ZU.cleanAuthor(article.articleAuthor, 'author'));
item.publicationTitle = issue.magazineArabicName;
item.place = issue.countryName;
item.issue = issue.issuenumber || issue.issueName;
item.date = ZU.strToISO(arabicToEnglishDate(issue.newIssueDate));
item.url = url;
let attachment = { title: "Snapshot" };
if (doc) {
attachment.document = doc;
}
else {
attachment.url = url;
}
item.attachments.push(attachment);
item.complete();
}
// just so we get months on non-Arabic locales
function arabicToEnglishDate(date) {
return date
.replace('يناير', 'January')
.replace('فبراير', 'February')
.replace('مارس', 'March')
.replace('أبريل', 'April')
.replace('إبريل', 'April')
.replace('مايو', 'May')
.replace('يونيو', 'June')
.replace('يونية', 'June')
.replace('يوليو', 'July')
.replace('يوليو', 'July')
.replace('أغسطس', 'August')
.replace('سبتمبر', 'September')
.replace('أكتوبر', 'October')
.replace('نوفمبر', 'November')
.replace('ديسمبر', 'December');
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://archive.alsharekh.org/Articles/290/20647/469598",
"items": [
{
"itemType": "magazineArticle",
"title": "الخط العربي: فلسفة التأصيل الجمالي والتفريع الفني",
"creators": [
{
"firstName": "بركات محمد",
"lastName": "مراد",
"creatorType": "author"
}
],
"date": "2004-04-01",
"issue": "11",
"libraryCatalog": "Alsharekh",
"publicationTitle": "حروف عربية",
"shortTitle": "الخط العربي",
"url": "https://archive.alsharekh.org/Articles/290/20647/469598",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://archive.alsharekh.org/Articles/312/21129/479105",
"items": [
{
"itemType": "magazineArticle",
"title": "الرحالة والباحثون الروس في تاريخ الجزيرة العربية وآثارها \"دراسة تقويمية\"",
"creators": [
{
"firstName": "عبد الرحمن الطيب",
"lastName": "الأنصاري",
"creatorType": "author"
}
],
"date": "2005-01-01",
"issue": "11",
"libraryCatalog": "Alsharekh",
"publicationTitle": "أدوماتو",
"url": "https://archive.alsharekh.org/Articles/312/21129/479105",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://archive.alsharekh.org/Articles/174/16356/368236",
"items": [
{
"itemType": "magazineArticle",
"title": "أسلوب النقض في كتابات الرحالة الأوربيين",
"creators": [
{
"firstName": "حسن",
"lastName": "غزالة",
"creatorType": "author"
}
],
"date": "2005-06-01",
"issue": "20",
"libraryCatalog": "Alsharekh",
"publicationTitle": "جذور",
"url": "https://archive.alsharekh.org/Articles/174/16356/368236",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://archive.alsharekh.org/contents/174/19785",
"defer": true,
"items": "multiple"
},
{
"type": "web",
"url": "https://archive.alsharekh.org/AuthorArticles/124",
"items": "multiple"
}
]
/** END TEST CASES **/

144
Amazon.js
View File

@ -8,15 +8,10 @@
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsbv",
"lastUpdated": "2020-09-04 21:40:05"
"browserSupport": "gcsibv",
"lastUpdated": "2025-03-20 15:38:12"
}
// attr()/text() v2
// eslint-disable-next-line
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
function detectWeb(doc, _url) {
if (getSearchResults(doc, true)) {
return (Zotero.isBookmarklet ? "server" : "multiple");
@ -284,8 +279,10 @@ function scrape(doc, url) {
)];
}
if (!role) role = 'author';
name = ZU.trimInternal(ZU.xpathText(authors[i], './span/a[contains(@class, "a-link-normal")]|./a[contains(@class, "a-link-normal")]'))
.replace(/\s*\([^)]+\)/, '').replace(/,\s*$/, '');
name = ZU.trimInternal(
ZU.xpathText(authors[i], './span/a[contains(@class, "a-link-normal")]|./a[contains(@class, "a-link-normal")]')
|| text(authors[i], ':scope > span > a[data-a-component="text-link"]')
).replace(/\s*\([^)]+\)/, '').replace(/,\s*$/, '');
if (item.itemType == 'audioRecording') {
item.creators.push({
lastName: name,
@ -317,8 +314,10 @@ function scrape(doc, url) {
item.abstractNote = abstractNode.textContent.trim();
}
}
} else {
item.abstractNote = text(doc, '#bookDescription_feature_div .a-expander-content');
}
// Extract info into an array
var info = {},
els = ZU.xpath(doc, '//div[@class="content"]/ul/li[b]');
@ -331,6 +330,26 @@ function scrape(doc, url) {
}
}
}
if (!els.length) {
// New design encountered 08/31/2020
els = doc.querySelectorAll('ul.detail-bullet-list li');
if (!els.length) {
// New design encountered 2022-11-20
els = doc.querySelectorAll('#detailBullets_feature_div ul > li span');
}
for (let el of els) {
let key = text(el, '.a-list-item span:first-child');
let value = text(el, '.a-list-item span:nth-child(2)');
if (key && value) {
key = key.replace(/\s*:\s*$/, "");
// Extra colon in Language field as of 9/4/2020
key = key.replace(/\s*:$/, '');
// The colon is surrounded by RTL/LTR marks as of 6/24/2021
key = key.replace(/[\s\u200e\u200f]*:[\s\u200e\u200f]*$/, '');
info[key.toLowerCase()] = value.trim();
}
}
}
if (!els.length) {
// New design encountered 06/30/2013
els = ZU.xpath(doc, '//tr[td[@class="a-span3"]][td[@class="a-span9"]]');
@ -343,26 +362,11 @@ function scrape(doc, url) {
}
}
}
if (!els.length) {
// New design encountered 08/31/2020
els = doc.querySelectorAll('ul.detail-bullet-list li');
for (let el of els) {
let key = text(el, '.a-list-item span:first-child');
let value = text(el, '.a-list-item span:nth-child(2)');
if (key && value) {
key = key.replace(/\s*:\s*$/, "");
// Extra colon in Language field as of 9/4/2020
key = key.replace(/\s*:$/, '');
info[key.toLowerCase()] = value.trim();
}
}
}
item.ISBN = getField(info, 'ISBN');
if (item.ISBN) {
item.ISBN = ZU.cleanISBN(item.ISBN);
}
// Date
for (let i = 0; i < DATE.length; i++) {
item.date = info[DATE[i]];
@ -384,9 +388,10 @@ function scrape(doc, url) {
item.edition = m[2].trim()
.replace(/^(Auflage|Édition)\s?:/, '')
// "FISCHER Taschenbuch; 15. Auflage (1. Mai 1992)""
.replace(/\. (Auflage|Édition)\s*/, '');
.replace(/\. (Auflage|[EÉ]dition)\s*/, '');
}
if (m[3] && m[3].search(/\b\d{4}\b/) != -1) item.date = m[3].trim(); // Looks like a date
// Looks like a date
if (m[3] && m[3].search(/\b\d{4}\b/) != -1) item.date = ZU.strToISO(m[3].trim());
}
var pages = getField(info, 'Hardcover') || getField(info, 'Paperback') || getField(info, 'Print Length');
if (pages) item.numPages = parseInt(pages);
@ -461,7 +466,6 @@ function scrape(doc, url) {
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
@ -478,14 +482,13 @@ var testCases = [
"creatorType": "author"
}
],
"date": "April 1, 2010",
"date": "2010-04-01",
"ISBN": "9780810989894",
"abstractNote": "Now in paperback! Pass, and have it made. Fail, and suffer the consequences. A master of teen thrillers tests readers courage in an edge-of-your-seat novel that echoes the fears of exam-takers everywhere. Ann, a teenage girl living in the security-obsessed, elitist United States of the very near future, is threatened on her way home from school by a mysterious man on a black motorcycle. Soon she and a new friend are caught up in a vast conspiracy of greed involving the mega-wealthy owner of a school testing company. Students who pass his test have it made; those who dont, disappear . . . or worse. Will Ann be next? For all those who suspect standardized tests are an evil conspiracy, heres a thriller that really satisfies! Praise for Test “Fast-paced with short chapters that end in cliff-hangers . . . good read for moderately reluctant readers. Teens will be able to draw comparisons to contemporary societys shift toward standardized testing and ecological concerns, and are sure to appreciate the spoofs on NCLB.” ―School Library Journal “Part mystery, part action thriller, part romance . . . environmental and political overtones . . . fast pace and unique blend of genres holds attraction for younger teen readers.” ―Booklist",
"edition": "Reprint Edition",
"edition": "Reprint edition",
"language": "English",
"libraryCatalog": "Amazon",
"numPages": 320,
"place": "New York",
"publisher": "Amulet Paperbacks",
"attachments": [
{
@ -502,7 +505,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords=foot&x=0&y=0",
"url": "https://www.amazon.com/s?k=foot&i=stripbooks&x=0&y=0&ref=nb_sb_noss",
"items": "multiple"
},
{
@ -538,7 +541,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.amazon.com/s?ie=UTF8&keywords=The%20Harvard%20Concise%20Dictionary%20of%20Music%20and%20Musicians&index=blended&Go=o",
"url": "https://www.amazon.com/s?k=The+Harvard+Concise+Dictionary+of+Music+and+Musicians&Go=o",
"items": "multiple"
},
{
@ -596,7 +599,7 @@ var testCases = [
}
],
"date": "May 20, 2003",
"language": "English (Dolby Digital 5.1), English (DTS 5.1), French (Dolby Digital 5.1), Unqualified (DTS ES 6.1), English (Dolby Digital 2.0 Surround)",
"language": "English (Dolby Digital 2.0 Surround), English (Dolby Digital 5.1), English (DTS 5.1), French (Dolby Digital 5.1), Unqualified (DTS ES 6.1)",
"libraryCatalog": "Amazon",
"runningTime": "1 hour and 55 minutes",
"studio": "Sony Pictures Home Entertainment",
@ -613,11 +616,6 @@ var testCases = [
}
]
},
{
"type": "web",
"url": "http://www.amazon.com/gp/registry/registry.html?ie=UTF8&id=1Q7ELHV59D7N&type=wishlist",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.amazon.fr/Candide-Fran%C3%A7ois-Marie-Voltaire-Arouet-dit/dp/2035866014/ref=sr_1_2?s=books&ie=UTF8&qid=1362329827&sr=1-2",
@ -632,13 +630,13 @@ var testCases = [
"creatorType": "author"
}
],
"date": "17 août 2011",
"date": "2011",
"ISBN": "9782035866011",
"abstractNote": "Que signifie ce nom \"Candide\" : innocence de celui qui ne connaît pas le mal ou illusion du naïf qui n'a pas fait l'expérience du monde ? Voltaire joue en 1759, après le tremblement de terre de Lisbonne, sur ce double sens. Il nous fait partager les épreuves fictives d'un jeune homme simple, confronté aux leurres de l'optimisme, mais qui n'entend pas désespérer et qui en vient à une sagesse finale, mesurée et mystérieuse. Candide n'en a pas fini de nous inviter au gai savoir et à la réflexion.",
"edition": "Larousse édition",
"language": "Français",
"libraryCatalog": "Amazon",
"numPages": 176,
"place": "Paris",
"publisher": "Larousse",
"attachments": [
{
@ -655,7 +653,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.amazon.de/Fiktionen-Erz%C3%A4hlungen-Jorge-Luis-Borges/dp/3596105811/ref=sr_1_1?ie=UTF8&qid=1362329791&sr=8-1",
"url": "https://www.amazon.de/Fiktionen-Erz%C3%A4hlungen-Jorge-Luis-Borges/dp/3596105811/ref=sr_1_1?ie=UTF8&qid=1362329791&sr=8-1&lang=de-de&language=de_DE",
"items": [
{
"itemType": "book",
@ -667,10 +665,10 @@ var testCases = [
"creatorType": "author"
}
],
"date": "1. Mai 1992",
"date": "1992",
"ISBN": "9783596105816",
"abstractNote": "Gleich bei seinem Erscheinen in den 40er Jahren löste Jorge Luis Borges erster Erzählband »Fiktionen« eine literarische Revolution aus. Erfundene Biographien, fiktive Bücher, irreale Zeitläufe und künstliche Realitäten verflocht Borges zu einem geheimnisvollen Labyrinth, das den Leser mit seinen Rätseln stets auf neue herausfordert. Zugleich begründete er mit seinen berühmten Erzählungen wie»Die Bibliothek zu Babel«, «Die kreisförmigen Ruinen« oder»Der Süden« den modernen »Magischen Realismus«. »Obwohl sie sich im Stil derart unterscheiden, zeigen zwei Autoren uns ein Bild des nächsten Jahrtausends: Joyce und Borges.« Umberto Eco",
"edition": "15",
"abstractNote": "Gleich bei seinem Erscheinen in den 40er Jahren löste Jorge Luis Borges erster Erzählband »Fiktionen« eine literarische Revolution aus. Erfundene Biographien, fiktive Bücher, irreale Zeitläufe und künstliche Realitäten verflocht Borges zu einem geheimnisvollen Labyrinth, das den Leser mit seinen Rätseln stets auf neue herausfordert. Zugleich begründete er mit seinen berühmten Erzählungen wie»Die Bibliothek zu Babel«, «Die kreisförmigen Ruinen« oder»Der Süden« den modernen »Magischen Realismus«.\n\n»Obwohl sie sich im Stil derart unterscheiden, zeigen zwei Autoren uns ein Bild des nächsten Jahrtausends: Joyce und Borges.« Umberto Eco",
"edition": "16",
"language": "Deutsch",
"libraryCatalog": "Amazon",
"numPages": 192,
@ -704,11 +702,11 @@ var testCases = [
"creatorType": "author"
}
],
"date": "1 Dec. 2010",
"date": "2010-12-01",
"abstractNote": "Novel by Charles Dickens, published both serially and in book form in 1859. The story is set in the late 18th century against the background of the French Revolution. Although Dickens borrowed from Thomas Carlyle's history, The French Revolution, for his sprawling tale of London and revolutionary Paris, the novel offers more drama than accuracy. The scenes of large-scale mob violence are especially vivid, if superficial in historical understanding. The complex plot involves Sydney Carton's sacrifice of his own life on behalf of his friends Charles Darnay and Lucie Manette. While political events drive the story, Dickens takes a decidedly antipolitical tone, lambasting both aristocratic tyranny and revolutionary excess--the latter memorably caricatured in Madame Defarge, who knits beside the guillotine. The book is perhaps best known for its opening lines, \"It was the best of times, it was the worst of times,\" and for Carton's last speech, in which he says of his replacing Darnay in a prison cell, \"It is a far, far better thing that I do, than I have ever done; it is a far, far better rest that I go to, than I have ever known.\" -- The Merriam-Webster Encyclopedia of Literature",
"language": "English",
"libraryCatalog": "Amazon",
"numPages": 264,
"numPages": 290,
"publisher": "Public Domain Books",
"attachments": [
{
@ -737,23 +735,23 @@ var testCases = [
"creatorType": "author"
},
{
"firstName": "B.",
"firstName": "Björn",
"lastName": "Berg",
"creatorType": "contributor"
},
{
"firstName": "A. Palme Larussa",
"firstName": "Annuska Palme Larussa",
"lastName": "Sanavio",
"creatorType": "translator"
}
],
"date": "26 giugno 2008",
"date": "2008",
"ISBN": "9788882038670",
"abstractNote": "Si pensa che soprattutto in una casa moderna, con prese elettriche, gas, balconi altissimi un bambino possa mettersi in pericolo: Emil vive in una tranquilla casa di campagna, ma riesce a ficcare la testa in una zuppiera e a rimanervi incastrato, a issare la sorellina Ida in cima all'asta di una bandiera, e a fare una tale baldoria alla fiera del paese che i contadini decideranno di organizzare una colletta per spedirlo in America e liberare così la sua povera famiglia. Ma questo succederà nel prossimo libro di Emil, perché ce ne sarà un altro, anzi due, tante sono le sue monellerie. Età di lettura: da 7 anni.",
"edition": "3° edizione",
"language": "Italiano",
"libraryCatalog": "Amazon",
"numPages": 72,
"place": "Milano",
"publisher": "Nord-Sud",
"attachments": [
{
@ -791,16 +789,6 @@ var testCases = [
"lastName": "Nagai",
"creatorType": "castMember"
},
{
"firstName": "Ed",
"lastName": "Asner",
"creatorType": "castMember"
},
{
"firstName": "Christopher",
"lastName": "Plummer",
"creatorType": "castMember"
},
{
"firstName": "Pete",
"lastName": "Docter",
@ -845,7 +833,7 @@ var testCases = [
}
],
"libraryCatalog": "Amazon",
"runningTime": "1:08:58",
"runningTime": "1:09:16",
"attachments": [
{
"title": "Amazon.com Link",
@ -873,14 +861,16 @@ var testCases = [
"creatorType": "author"
}
],
"date": "2012/8/2",
"date": "2012-08-02",
"ISBN": "9780099578079",
"abstractNote": "The year is 1Q84. This is the real world, there is no doubt about that. But in this world, there are two moons in the sky. In this world, the fates of two people, Tengo and Aomame, are closely intertwined. They are each, in their own way, doing something very dangerous. And in this world, there seems no way to save them both. Something extraordinary is starting.",
"language": "英語",
"abstractNote": "The year is 1Q84. This is the real world, there is no doubt about that. But in this world, there are two moons in the sky. In this world, the fates of two people, Tengo and Aomame, are closely intertwined. They are each, in their own way, doing something very dangerous. And in this world, there seems no way to save them both. Something extraordinary is starting.",
"edition": "Combined edition",
"language": "English",
"libraryCatalog": "Amazon",
"numPages": 1328,
"publisher": "Vintage",
"shortTitle": "1Q84",
"place": "London",
"attachments": [
{
"title": "Amazon.com Link",
@ -896,7 +886,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.amazon.com/Mark-LeBar/e/B00BU8L2DK",
"url": "https://www.amazon.com/Mark-LeBar/e/B00BU8L2DK",
"items": "multiple"
},
{
@ -918,7 +908,7 @@ var testCases = [
"creatorType": "editor"
}
],
"date": "April 28, 1998",
"date": "1998-04-28",
"ISBN": "9780521418195",
"abstractNote": "The first printed text of Shakespeare's Hamlet is about half the length of the more familiar second quarto and Folio versions. It reorders and combines key plot elements to present its own workable alternatives. This is the only modernized critical edition of the 1603 quarto in print. Kathleen Irace explains its possible origins, special features and surprisingly rich performance history, and while describing textual differences between it and other versions, offers alternatives that actors or directors might choose for specific productions.",
"edition": "First Edition",
@ -954,12 +944,12 @@ var testCases = [
"creatorType": "author"
}
],
"date": "1977/9/16",
"date": "1977-09-16",
"ISBN": "9784003314210",
"abstractNote": "帯ありません。若干のスレはありますがほぼ普通です。小口、天辺に少しヤケがあります。中身は少しヤケはありますがきれいです。",
"language": "日本語",
"language": "Japanese",
"libraryCatalog": "Amazon",
"publisher": "岩波書店",
"abstractNote": "帯ありません。若干のスレはありますがほぼ普通です。小口、天辺に少しヤケがあります。中身は少しヤケはありますがきれいです。",
"attachments": [
{
"title": "Amazon.com Link",
@ -987,13 +977,12 @@ var testCases = [
"creatorType": "author"
}
],
"date": "April 24, 2018",
"date": "2018-08-24",
"ISBN": "9781333821388",
"abstractNote": "Excerpt from Studies in Saiva-SiddhantaEuropean Sanskritist, unaware perhaps of the bearings of the expression, rendered the collocation Parama-hamsa' into 'great goose'. The strictly pedagogic purist may endeavour to justify such puerile versions on etymological grounds, but they stand Self-condemned as mal-interpretations reecting anything but the sense and soul of the original. Such lapses into unwitting ignorance, need never be expected in any of the essays contained in the present collection, as our author is not only a sturdy and indefatigable researcher in Tamil philosophic literature illuminative Of the Agamic religion, but has also, in his quest after Truth, freely utilised the services of those Indigenous savam's, who represent the highest water-mark of Hindu traditional learning and spiritual associations at the present-day.About the PublisherForgotten Books publishes hundreds of thousands of rare and classic books. Find more at www.forgottenbooks.comThis book is a reproduction of an important historical work. Forgotten Books uses state-of-the-art technology to digitally reconstruct the work, preserving the original format whilst repairing imperfections present in the aged copy. In rare cases, an imperfection in the original, such as a blemish or missing page, may be replicated in our edition. We do, however, repair the vast majority of imperfections successfully; any imperfections that remain are intentionally left to preserve the state of such historical works.",
"abstractNote": "Excerpt from Studies in Saiva-SiddhantaEuropean Sanskritist, unaware perhaps of the bearings of the expression, rendered the collocation Parama-hamsa' into 'great goose'. The strictly pedagogic purist may endeavour to justify such puerile versions on etymological grounds, but they stand Self-condemned as mal-interpretations re?ecting anything but the sense and soul of the original. Such lapses into unwitting ignorance, need never be expected in any of the essays contained in the present collection, as our author is not only a sturdy and indefatigable researcher in Tamil philosophic literature illuminative Of the Agamic religion, but has also, in his quest after Truth, freely utilised the services of those Indigenous savam's, who represent the highest water-mark of Hindu traditional learning and spiritual associations at the present-day.",
"language": "English",
"libraryCatalog": "Amazon",
"numPages": 398,
"place": "Place of publication not identified",
"numPages": 396,
"publisher": "Forgotten Books",
"attachments": [
{
@ -1032,10 +1021,11 @@ var testCases = [
"creatorType": "author"
}
],
"date": "2015年5月1日",
"abstractNote": "《中国之翼》是一本书写了一段未被透露的航空编年史的篇章,它讲述了二战时期亚洲战场动荡的背景下的航空冒险的扣人心弦的故事。故事的主体是激动人心的真实的“空中兄弟连”的冒险事迹。正是这些人在二战期间帮助打开了被封锁的中国的天空,并勇敢的在各种冲突中勇敢守卫着它。这是一段值得被更多的中国人和美国人知晓并铭记的航空史和中美关系史。",
"date": "2015-05-01",
"edition": "第 1st 版",
"libraryCatalog": "Amazon",
"publisher": "社会科学文献出版社",
"abstractNote": "《中国之翼》是一本书写了一段未被透露的航空编年史的篇章,它讲述了二战时期亚洲战场动荡的背景下的航空冒险的扣人心弦的故事。故事的主体是激动人心的真实的“空中兄弟连”的冒险事迹。正是这些人在二战期间帮助打开了被封锁的中国的天空,并勇敢的在各种冲突中勇敢守卫着它。这是一段值得被更多的中国人和美国人知晓并铭记的航空史和中美关系史。",
"attachments": [
{
"title": "Amazon.com Link",

View File

@ -0,0 +1,592 @@
{
"translatorID": "d13eb92e-fb16-41e0-9a24-73bad50f9bb7",
"label": "American Archive of Public Broadcasting",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?americanarchive\\.org/catalog",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-28 19:23:21"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('meta[property="og:video"]')) {
return "tvBroadcast";
}
else if (doc.querySelector('meta[property="og:audio"]')) {
return "radioBroadcast";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h2 > a[href*="/catalog/"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
if (item.abstractNote) {
item.abstractNote = item.abstractNote.replace(/\n+/g, ' ');
}
for (let entry of doc.querySelectorAll('.contributors dl')) {
for (let b of entry.querySelectorAll('b')) {
let label = b.textContent;
let name = b.nextSibling.textContent.trim().replace(/^Dr\b/, '');
let type = 'contributor';
let institution = false;
if (label.includes('Reporter') || label.includes('Host')) {
type = 'castMember';
}
else if (label.includes('Director')) {
type = 'director';
}
else if (label.includes('Writer')) {
type = 'scriptwriter';
}
else if (label.includes('Produc')) {
type = 'producer';
}
else if (label.includes('Copyright Holder')) {
continue;
}
if (label.includes('Organization')) {
institution = true;
}
if (institution) {
item.creators.push({
lastName: name,
creatorType: type,
fieldMode: 1
});
}
else {
item.creators.push(ZU.cleanAuthor(name, type, name.includes(', ')));
}
}
}
for (let dt of doc.querySelectorAll('dt')) {
let key = ZU.trimInternal(dt.textContent);
let dd = dt.nextElementSibling;
while (dd && dd.tagName == 'DD') {
let value = ZU.trimInternal(dd.textContent);
switch (key) {
case 'Contributing Organization':
case 'Producing Organization': {
if (item.network) break;
if (!item.creators.length) {
item.creators.push({
lastName: value.replace(/\s*\(.*\)/, ''),
creatorType: 'contributor',
fieldMode: 1
});
}
let [, broadcaster, place] = value.match(/^([^(]*)(?:\((.+)\))?/);
if (/([WK][A-Z]{2,3}|PBS|NPR|Broadcast|Network)/.test(broadcaster)) {
item.network = broadcaster;
}
if (place) item.place = place;
break;
}
case 'Date':
case 'Created':
if (!item.date) {
item.date = ZU.strToISO(value);
}
break;
case 'Genres':
case 'Topics':
item.tags.push({ tag: value });
break;
case 'Duration':
item.runningTime = value;
break;
case 'Series':
item.programTitle = value;
break;
case 'Episode':
item.title = value;
break;
case 'Episode Number':
item.episodeNumber = value;
break;
case 'Rights':
item.rights = value;
break;
}
dd = dd.nextElementSibling;
}
}
// from the suggested citation on item pages
item.archive = 'American Archive of Public Broadcasting (GBH and the Library of Congress)';
// would like to grab the video file and attach it here, but they do a
// referer check that precludes that.
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = detectWeb(doc, url);
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip_83-407wmf7g",
"items": [
{
"itemType": "tvBroadcast",
"title": "One More Harvest",
"creators": [
{
"lastName": "PBS Utah",
"creatorType": "contributor",
"fieldMode": 1
}
],
"date": "1984",
"abstractNote": "This program profiles Utah farmer Melvin Good and his family. During the program, Melvin reminisces about his life and growing up on the farm; his grandchildren discuss the decision to becoming farmers or pursue another vocation; family members describe Melvin's and their passion for farming; and Melvin describes the process of harvesting a crop.",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "PBS Utah",
"place": "Salt Lake City, Utah",
"rights": "KUED",
"runningTime": "00:28:27",
"url": "http://americanarchive.org/catalog/cpb-aacip-83-407wmf7g",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Agriculture"
},
{
"tag": "Documentary"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip_223-225b07vs",
"items": [
{
"itemType": "radioBroadcast",
"title": "Art and Violence",
"creators": [
{
"firstName": "Amy",
"lastName": "Tardiff",
"creatorType": "castMember"
}
],
"date": "1995-06-17",
"abstractNote": "This segment reports on an artist who discusses the importance of art in response to the violence of contemporary society.",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "WGCU Public Media",
"place": "Fort Myers, Florida",
"rights": "No copyright statement in content.",
"runningTime": "00:04:33",
"url": "http://americanarchive.org/catalog/cpb-aacip-223-225b07vs",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Fine Arts"
},
{
"tag": "Local Communities"
},
{
"tag": "News"
},
{
"tag": "News Report"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip-526-cv4bn9z59z",
"items": [
{
"itemType": "tvBroadcast",
"title": "The Test",
"creators": [
{
"lastName": "WTVI",
"creatorType": "producer",
"fieldMode": 1
},
{
"lastName": "Charlotte-Mecklenburg Board of Education",
"creatorType": "producer",
"fieldMode": 1
}
],
"abstractNote": "\"'THE TEST' contains practical suggestions on how to reduce a student's trauma when taking a standardized test.\"--1979 Peabody Awards entry form.",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "WTVI",
"runningTime": "00:10:32.265",
"url": "http://americanarchive.org/catalog/cpb-aacip-526-cv4bn9z59z",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip-153-956djvtx",
"items": [
{
"itemType": "tvBroadcast",
"title": "Front Street Weekly",
"creators": [
{
"firstName": "Vivian",
"lastName": "Condeni",
"creatorType": "producer"
},
{
"firstName": "Lyle",
"lastName": "Graham",
"creatorType": "director"
},
{
"firstName": "Lyle",
"lastName": "Graham",
"creatorType": "producer"
},
{
"firstName": "Gwyneth Gamble",
"lastName": "Booth",
"creatorType": "castMember"
},
{
"lastName": "Oregon Public Broadcasting",
"creatorType": "producer",
"fieldMode": 1
}
],
"date": "1984-11-21",
"abstractNote": "This episode contains the following segments. The first segment, \"Spiritual Epidemic?,\" features individuals whose search for enlightenment has become all-consuming. The second, \"Magic in the Night?,\" investigates fire-walking and whether it amounts to anything more than a financial scam. The third segment, \"Salem Art Fair '85,\" is a profile on the annual 3-day summer festival. Front Street Weekly is a news magazine featuring segments on current events and topics of interest to the local community.",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "Oregon Public Broadcasting",
"programTitle": "Front Street Weekly",
"rights": "Oregon Public Broadcasting c. 1985",
"runningTime": "00:29:48",
"url": "http://americanarchive.org/catalog/cpb-aacip-153-956djvtx",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Crafts"
},
{
"tag": "Health"
},
{
"tag": "Local Communities"
},
{
"tag": "Magazine"
},
{
"tag": "News"
},
{
"tag": "News Report"
},
{
"tag": "Religion"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip_260-2683bp5r",
"items": [
{
"itemType": "tvBroadcast",
"title": "Gerry Spence",
"creators": [
{
"firstName": "Kyle",
"lastName": "Nicholoff",
"creatorType": "director"
},
{
"firstName": "Ruby",
"lastName": "Calvert",
"creatorType": "producer"
},
{
"firstName": "Gerry",
"lastName": "Spence",
"creatorType": "contributor"
},
{
"firstName": "Deborah",
"lastName": "Hammons",
"creatorType": "castMember"
},
{
"firstName": "Deborah",
"lastName": "Hammons",
"creatorType": "producer"
},
{
"lastName": "Wyoming PBS",
"creatorType": "producer",
"fieldMode": 1
}
],
"abstractNote": "The subject of this episode is Wyoming native Gerry Spence, a best-selling author considered by many to be America's greatest trial lawyer. He sits down with Deborah Hammons to talk about his past growing up in the city of Riverton. \"Main Street, Wyoming is a documentary series exploring aspects of Wyoming's local history and culture.\"",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"episodeNumber": "605",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "Wyoming PBS",
"programTitle": "Main Street, Wyoming",
"rights": "Main Street, Wyoming is a public affairs presentation of Wyoming Public Television 1995 KCWC-TV",
"runningTime": "00:29:10",
"url": "http://americanarchive.org/catalog/cpb-aacip-260-2683bp5r",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "History"
},
{
"tag": "Interview"
},
{
"tag": "Local Communities"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip-3d6c55fdb1b",
"items": [
{
"itemType": "radioBroadcast",
"title": "Big Bird - America's Favorite Flightless Bird",
"creators": [
{
"lastName": "BirdNote",
"creatorType": "producer",
"fieldMode": 1
},
{
"firstName": "Bob",
"lastName": "Sundstrom",
"creatorType": "scriptwriter"
}
],
"date": "2018-11-20",
"abstractNote": "Theres at least one bird that nearly everyone knows on sight: Big Bird. Hes been a Sesame Street celebrity since 1969, cutting a colorful figure for pre-school fans and their parents across the world. Big Bird is really a big kid with a kind heart, who makes friends everywhere he goes. He helps children feel okay about not knowing everything because, well, Big Bird is still figuring things out himself. Like the alphabet. When Big Bird first saw the alphabet, he thought it was one really, really long word. And Michael Stein knows how to pronounce it. Have a listen!",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"place": "Seattle, Washington",
"programTitle": "BirdNote",
"rights": "Sounds for BirdNote stories were provided by the Macaulay Library at the Cornell Lab of Ornithology, Xeno-Canto, Martyn Stewart, Chris Peterson, John Kessler, and others. Where music was used, fair use was taken into consideration. Individual credits are found at the bottom of each transcript.",
"runningTime": "00:01:45.195",
"url": "http://americanarchive.org/catalog/cpb-aacip-3d6c55fdb1b",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Science"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog/cpb-aacip-529-df6k06z734",
"items": [
{
"itemType": "radioBroadcast",
"title": "An Examination of Testing",
"creators": [
{
"firstName": "William",
"lastName": "Koch",
"creatorType": "contributor"
},
{
"firstName": "Panchita",
"lastName": "Garrett",
"creatorType": "contributor"
},
{
"firstName": "Kathy",
"lastName": "Glover",
"creatorType": "contributor"
},
{
"lastName": "KUT Longhorn Radio Network",
"creatorType": "producer",
"fieldMode": 1
}
],
"date": "1982-04-02",
"abstractNote": "Hosts Kathy Glover and Panchita Garrett talks with Dr. William Koch, Assoc. Dir. Of the Measurement and Evaluation Center at UT Austin. They discuss the nature of standardized testing, how, when and where it is used.",
"archive": "American Archive of Public Broadcasting (GBH and the Library of Congress)",
"language": "en",
"libraryCatalog": "americanarchive.org",
"network": "KUT Longhorn Radio Network",
"programTitle": "The Inquiring Mind",
"rights": "KUT, COPIES OKAY",
"runningTime": "00:24:32",
"url": "http://americanarchive.org/catalog/cpb-aacip-529-df6k06z734",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "Education"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://americanarchive.org/catalog?q=The+Inquiring+Mind&utf8=%E2%9C%93&f[access_types][]=online",
"items": "multiple"
}
]
/** END TEST CASES **/

382
Anarchist Library.js Normal file
View File

@ -0,0 +1,382 @@
{
"translatorID": "1a31e4c5-22ed-4b5b-a75f-55476db29a44",
"label": "Anarchist Library",
"creator": "Sister Baæ'l",
"target": "https://theanarchistlibrary\\.org/(latest|library|stats/popular|category/topic|category/author|special/index|search)",
"minVersion": "7.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2025-10-25 01:31:43"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2025 Dandelion Good and the righteous Anti Toil Theologians at Iliff
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
/*
***** BEGIN ATTRIBUTION BLOCK *****
This translator was developed by Dandelion Good.
If you do any work on this translator, please add yourself here <3.
*/
var allAttachmentTypes = {
"Plain PDF": { ext: ".pdf", mimeType: "application/pdf" },
"A4 PDF": { ext: ".a4.pdf", mimeType: "application/pdf" },
"Letter PDF": { ext: ".lt.pdf", mimeType: "application/pdf" },
EPub: { ext: ".epub", mimeType: "application/epub+zip" },
"Printer-friendly HTML": { ext: ".html", mimeType: "text/html" },
LaTeX: { ext: ".tex", mimeType: "application/x-tex" },
"Plain Text": { ext: ".muse", mimeType: "text/plain" },
"Source Zip:": { ext: ".zip", mimeType: "application/zip" },
Snapshot: { ext: "snapshot", mimeType: "text/html" }
};
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll("a.list-group-item");
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(text(row, "strong"));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
async function scrape(doc, url = doc.location.href) {
// ToDo: get fancier here, allow other types
let item = new Zotero.Item('manuscript');
// These may be expanded on in the future
let attachmentTypes = {
PDF: allAttachmentTypes["Plain PDF"],
};
item.url = url;
item.language = attr(doc, "html", "lang");
let itemType = attr(doc, '[property~="og:type"]', 'content');
let tagNodeList = doc.querySelectorAll(`[property~="og:${itemType}:tag"]`);
let description = attr(doc, '[property~="og:description"]', 'content');
let author = attr(doc, `[property~="og:${itemType}:author"]`, 'content');
item.creators.push(ZU.cleanAuthor(author, "author"));
if (description) {
item.description = description;
// misses https://theanarchistlibrary.org/library/leo-tolstoy-the-complete-works-of-count-tolstoy-volume-12
let re = /(?<=[Tt]ranslated(?: +to [Ee]nglish)? +by ).*$/u;
let translatedMatch = description.match(re);
if (translatedMatch) {
item.creators.push(ZU.cleanAuthor(translatedMatch[0], "translator", translatedMatch[0].includes(",")));
}
}
let date = getPreambleVal(doc, "textdate");
let notes = getPreambleVal(doc, "preamblenotes");
// misses link here: https://theanarchistlibrary.org/library/margaret-killjoy-it-s-time-to-build-resilient-communities
let source = getPreambleVal(doc, "preamblesrc");
for (let tagNode of tagNodeList) {
item.tags.push({ tag: tagNode.content });
}
let title = attr(doc.head, '[property~="og:title"][content]', 'content');
item.title = title;
item.date = date;
if (notes) {
item.notes.push({ note: ZU.trimInternal(notes) });
}
if (source) {
item.notes.push({ note: `Source: ${ZU.trimInternal(source)}` });
}
for (let [typeName, typeInfo] of Object.entries(attachmentTypes)) {
let attachment = {
title: typeName,
url: `${doc.location.href}${typeInfo.ext}`,
mimeType: typeInfo.mimeType
};
if (typeInfo.ext == "snapshot") {
attachment.document = doc;
}
item.attachments.push(attachment);
}
item.complete();
}
var libraryRe = /library\//;
function detectWeb(doc, url) {
if (libraryRe.test(url)) {
return 'manuscript';
}
else if (getSearchResults(doc, true)) {
return 'multiple';
}
return false;
}
function getPreambleVal(doc, id) {
let preamble = doc.body.querySelector("div#preamble");
return text(preamble, `div#${id}`).slice(text(preamble, `span#${id}-label`).length);
}
async function doWeb(doc, url) {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url));
}
}
else {
await scrape(doc, url);
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://theanarchistlibrary.org/library/abel-paz-durruti-in-the-spanish-revolution",
"items": [
{
"itemType": "manuscript",
"title": "Durruti in the Spanish Revolution",
"creators": [
{
"creatorType": "author",
"firstName": "Abel",
"lastName": "Paz"
},
{
"creatorType": "translator",
"firstName": "Chuck",
"lastName": "Morse"
}
],
"date": "1996",
"url": "https://theanarchistlibrary.org/library/abel-paz-durruti-in-the-spanish-revolution",
"language": "en",
"attachments": [
{
"title": "PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Buenaventura Durruti"
},
{
"tag": "Spanish Revolution"
},
{
"tag": "biography"
}
],
"notes": [
{
"note": "Translated to English by Chuck Morse"
},
{
"note": "Source: Published by AK Press in 2006 (please support the publisher!). Retrieved on 19th September 2020 from https://libcom.org/library/durruti-spanish-revolution"
}
],
"seeAlso": [],
"libraryCatalog": "Anarchist Library"
}
]
},
{
"type": "web",
"url": "https://theanarchistlibrary.org/library/errico-malatesta-the-general-strike-and-the-insurrection-in-italy",
"items": [
{
"itemType": "manuscript",
"title": "The General Strike and the Insurrection in Italy",
"creators": [
{
"creatorType": "author",
"firstName": "Errico",
"lastName": "Malatesta"
}
],
"date": "1914",
"language": "en",
"url": "https://theanarchistlibrary.org/library/errico-malatesta-the-general-strike-and-the-insurrection-in-italy",
"libraryCatalog": "Anarchist Library",
"attachments": [
{
"title": "PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "General Strike"
},
{
"tag": "Italy"
},
{
"tag": "history"
},
{
"tag": "insurrection"
}
],
"notes": [
{
"note": "Freedom (London) 28, no. 303 (July 1914). In the article, written shortly after his escape from Italy and return to London, Malatesta provides an account of the Red Week, which broke out on 7 June 1914 in Ancona, where Malatesta lived."
},
{
"note": "Source: The Method of Freedom: An Errico Malatesta Reader, edited by Davide Turcato, translated by Paul Sharkey."
}
],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://theanarchistlibrary.org/library/ulrika-holgersson-britta-grondahl",
"items": [
{
"title": "Britta Gröndahl",
"itemType": "manuscript",
"creators": [
{
"firstName": "Ulrika",
"lastName": "Holgersson",
"creatorType": "author"
},
{
"firstName": "Alexia",
"lastName": "Grosjean",
"creatorType": "translator"
}
],
"notes": [
{
"note": "Translated by Alexia Grosjean."
},
{
"note": "Source: Retrieved on 11th March 2025 from www.skbl.se"
}
],
"tags": [
{
"tag": "Sweden"
},
{
"tag": "biography"
}
],
"date": "2018-03-08",
"seeAlso": [],
"libraryCatalog": "Anarchist Library",
"attachments": [
{
"title": "PDF",
"mimeType": "application/pdf"
}
],
"url": "https://theanarchistlibrary.org/library/ulrika-holgersson-britta-grondahl",
"language": "en"
}
]
},
{
"type": "web",
"url": "https://theanarchistlibrary.org/library/emile-armand-the-forerunners-of-anarchism",
"items": [
{
"itemType": "manuscript",
"title": "The Forerunners of Anarchism",
"creators": [
{
"creatorType": "author",
"firstName": "Emile",
"lastName": "Armand"
},
{
"creatorType": "translator",
"firstName": "",
"lastName": "Reddebrek"
}
],
"notes": [
{
"note": "Translated by Reddebrek."
},
{
"note": "Source: Provided by the translator."
}
],
"tags": [
{
"tag": "history"
},
{
"tag": "individualism"
},
{
"tag": "proto-anarchism"
}
],
"date": "1933",
"seeAlso": [],
"libraryCatalog": "Anarchist Library",
"attachments": [
{
"title": "PDF",
"mimeType": "application/pdf"
}
],
"url": "https://theanarchistlibrary.org/library/emile-armand-the-forerunners-of-anarchism",
"language": "en"
}
]
},
{
"type": "web",
"url": "https://theanarchistlibrary.org/search?query=kropotkin",
"items": "multiple"
},
{
"type": "web",
"url": "https://theanarchistlibrary.org/search?query=spirit",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -1,237 +1,164 @@
{
"translatorID": "0dda3f89-15de-4479-987f-cc13f1ba7999",
"label": "Ancestry.com US Federal Census",
"creator": "Elena Razlogova",
"target": "^https?://search\\.ancestry\\.com/.*(usfedcen|1890orgcen|1910uscenindex)",
"minVersion": "1.0.0b4.r1",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?ancestry\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "g",
"lastUpdated": "2015-06-02 10:57:09"
"browserSupport": "gcibv",
"lastUpdated": "2021-07-22 19:20:28"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var result = doc.evaluate('//div[@class="g_container"]/div[@class="g_panelWrap"]/div[@class="g_panelCore"]/div[@class="s_container"]/div[@class="p_rsltList"]', doc, nsResolver,
XPathResult.ANY_TYPE, null).iterateNext();
var rows = doc.evaluate('//div[@class="g_container"]/div[@class="g_panelWrap"]/div[@class="g_panelCore"]/div[@class="s_container"]/div[@class="p_rsltList"]/table/tbody/tr[@class="tblrow record"]',
doc, nsResolver, XPathResult.ANY_TYPE, null);
var row;
while (row = rows.iterateNext()) {
links = doc.evaluate('.//a', row, nsResolver, XPathResult.ANY_TYPE, null);
var linkNo=0;
while (link=links.iterateNext()) {
linkNo=linkNo+1;
}
break;
}
if (result && linkNo == 2) {
return "multiple";
} else {
var indivRe = /indiv=1/;
var m = indivRe.exec(doc.location.href);
var indiv = 0;
if (m) {
indiv = 1;
}
checkURL = doc.location.href.replace("pf=", "");
if (doc.location.href == checkURL && indiv == 1) {
return "bookSection";
}
}
}
// this US Federal Census scraper is a hack - so far there is no proper item type in Zotero for this kind of data (added to trac as a low priority ticket)
// this scraper creates proper citation for the census as a whole (should be cited as book)
// but also adds name, city, and state for a particular individual to the citation to make scanning for names & places easier in the middle pane
// (that's why the resulting item type is a book section)
// it also adds all searchable text as a snapshot and a scan of the census record as an image
function scrape(doc) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
// get initial census data; a proper census record item type should have separate fields for all of these except perhaps dbid
var info = doc.evaluate('//div[@class="facets"][@id="connect"]/div[@class="g_box"]/p/a',
doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (info) {
info = info.toString();
var data = new Array();
var parts = info.split(/[?&]/);
for (var i=0; i<parts.length; i++) {
var part = parts[i];
var index = part.indexOf("=");
if (index !== -1) {
data[part.substr(0, index)] = part.substr(index+1);
}
}
if (data.ln) {
var lastName = data.ln.replace(/\+/g, " ");
var firstName = data.fn.replace(/\+/g, " ");
} else {
var lastName = data.fn.replace(/\+/g, " ");
var firstName = "";
}
var dOb = data.by; // this does not get saved yet because no field is available; the info is in the snapshot
if (data.rfd) {
var yearRe = /([0-9]{4})/;
var m = yearRe.exec(data.rfd);
if (m) {
var year = m[1];
}
} else { var year = data.ry; }
var state = data.rs.replace(/\+/g, " ");
var county = data.rcnty.replace(/\+/g, " "); // this does not get saved yet because no field is available; the info is in the snapshot
var city = data.rcty.replace(/\+/g, " ");
var dbid = data.dbid;
}
// set census number for citation - let me know if this can be done in a better way
var censusYear = 0;
var censusNo = "";
var censusNos = new Array("1790", "First", "1800", "Second", "1810", "Third", "1820", "Fourth", "1830", "Fifth", "1840", "Sixth", "1850", "Seventh", "1860", "Eighth", "1870", "Ninth",
"1880", "Tenth", "1890", "Eleventh", "1900", "Twelfth", "1910", "Thirteenth", "1920", "Fourteenth", "1930", "Fifteenth")
for (var i in censusNos) {
if (censusYear == 1) { censusNo = censusNos[i] };
if (censusNos[i] == year) { censusYear = 1 } else {censusYear= 0 };
}
//begin adding item
var newItem = new Zotero.Item("bookSection");
newItem.title = city+", "+state; // this is not proper citation but is needed to easily scan for placenames in middle pane
newItem.publicationTitle = censusNo+" Census of the United States, "+year;
newItem.publisher = "National Archives and Records Administration";
newItem.place = "Washington, DC";
newItem.date = year;
// get snapshot with all searchable text and a simplified link to the record for the URL field
var dbRe = /db=([0-9a-z]+)/;
var m = dbRe.exec(doc.location.href);
if (m) {
db = m[1];
}
var snapshotRe = /\&h=([0-9]+)/;
var m = snapshotRe.exec(doc.location.href);
if (m) {
snapshotURL = "http://search.ancestry.com/cgi-bin/sse.dll?db="+db+"&indiv=1&pf=1&h="+m[1];
newItem.attachments.push({title:"Ancestry.com Snapshot", mimeType:"text/html", url:snapshotURL, snapshot:true});
cleanURL = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&fh=0&h="+m[1];
newItem.url = cleanURL;
}
// add particular individual being surveyed as contributor - this is not proper citation but is needed so one could easily scan for names in middle pane
var creator = new Array();
creator.firstName = firstName;
creator.lastName = lastName;
creator.creatorType = "author";
newItem.creators.push(creator);
//add proper author for citation
var creator = new Array();
creator.lastName = "United States of America, Bureau of the Census";
creator.creatorType = "contributor";
newItem.creators.push(creator);
// get scan of the census image
var scanInfo = doc.evaluate('//div[@id="record-main"]/table[@class="p_recTable"]/tbody/tr/td[2][@class="recordTN"]/a',
doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
if (scanInfo) {
var scanRe = /iid=([A-Z0-9_-]+)/;
var m = scanRe.exec(scanInfo);
if (m) {
scanURL = "http://content.ancestry.com/Browse/print_u.aspx?dbid="+dbid+"&iid="+m[1];
Zotero.debug("scan url: " + scanURL);
}
}
if (scanURL){
Zotero.Utilities.HTTP.doGet(scanURL, function(text) {
Zotero.debug("running doGet");
Zotero.debug(text);
var imageRe = /950 src="([^"]+)"/;
var m = imageRe.exec(text);
if (m) {
imageURL = m[1];
Zotero.debug("image url: " + imageURL);
newItem.attachments.push({title:"Ancestry.com Image", mimeType:"image/jpeg", url:imageURL, snapshot:true});
}
newItem.complete();
Zotero.done();
});
} else {
newItem.complete();
Zotero.done();
if (text(doc, '.pageTitle .pageIntro a').includes('United States Federal Census')) {
return "bookSection";
}
return false;
}
function doWeb(doc, url) {
var resultsRegexp = /&h=/;
if (resultsRegexp.test(url)) {
scrape(doc);
} else {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
scrape(doc, url);
}
function scrape(doc, url) {
let item = new Zotero.Item('bookSection');
item.title = text(doc, '.pageTitle span');
let [date, place, roll, page] = doc.querySelectorAll('.sourceText em'); // not ideal
item.bookTitle = text(doc, '.pageTitle .pageIntro a').trim()
+ ` [${place.textContent}]`;
item.publisher = 'National Archives and Records Administration';
// technically the Census is published 72 years after it's taken, but citing
// that way doesn't seem to be the convention.
item.date = date.textContent;
item.pages = `${page.textContent} (roll ${roll.textContent})`;
item.archive = 'Ancestry.com';
item.url = url.replace(/[?#].*/, '');
let recordTable = doc.querySelector('#recordServiceData');
if (recordTable) {
recordTable = recordTable.cloneNode(true);
// get census year for links to items
var yearRe = /db=([0-9]+)/;
var m = yearRe.exec(doc.location.href);
if (m) {
year = m[1];
}
let familyMembers = recordTable.querySelector('.tableContainerRow');
if (familyMembers) familyMembers.remove();
var dbRe = /db=([0-9a-z]+)/;
var m = dbRe.exec(doc.location.href);
if (m) {
db = m[1];
}
//select items
var items = new Array();
var listElts = doc.evaluate('//tr[@class="tblrow record keySelect"] | //tr[@class="tblrow record"] | //tr[@class="tblrowalt record"]',
doc, nsResolver, XPathResult.ANY_TYPE, null);
var recid;
var link;
var name;
while (listElt = listElts.iterateNext()) {
recInfo = doc.evaluate('.//a', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var recidRe = /recid=([0-9]+)/;
var m = recidRe.exec(recInfo);
if (m) {
recid = m[1];
}
link = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&fh=0&h="+recid;
name = doc.evaluate('.//span[@class="srchHit"]', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
items[link] = Zotero.Utilities.trimInternal(name);
}
items = Zotero.selectItems(items);
if (!items) return true;
var urls = new Array();
for (var i in items) {
urls.push(i);
}
Zotero.Utilities.processDocuments(urls, scrape, function() { Zotero.done(); });
Zotero.wait();
item.notes.push({
note: ZU.trimInternal(recordTable.outerHTML)
});
}
}
let imageSrc = attr(doc, '.photo.clickable img', 'src');
let dbId = imageSrc.match(/\/namespaces\/([^/]+)/)[1];
let imageId = imageSrc.match(/([^/]+)\.jpg/)[1];
ZU.doGet(
`/imageviewer/api/media/token?dbId=${dbId}&imageId=${imageId}`,
function (respText) {
try {
let json = JSON.parse(respText);
item.attachments.push({
title: 'Census Record',
mimeType: 'image/jpeg',
url: json.imageDownloadUrl
});
item.complete();
}
catch (_) {
item.complete(); // whatever, this is fragile
}
}
);
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.ancestry.com/discoveryui-content/view/131479739:2442?tid=&pid=&queryId=2a5ea51171527460c8a3755eb4b3fc1e&_phsrc=BYN5&_phstart=successSource",
"items": [
{
"itemType": "bookSection",
"title": "Albert Einstein",
"creators": [],
"date": "1940",
"archive": "Ancestry.com",
"bookTitle": "1940 United States Federal Census [Princeton, Mercer, New Jersey]",
"libraryCatalog": "Ancestry.com US Federal Census",
"pages": "10B (roll m-t0627-02357)",
"publisher": "National Archives and Records Administration",
"url": "https://www.ancestry.com/discoveryui-content/view/131479739:2442",
"attachments": [
{
"title": "Census Record",
"mimeType": "image/jpeg"
}
],
"tags": [],
"notes": [
{
"note": "<table id=\"recordServiceData\" class=\"table tableHorizontal tableHorizontalRuled\"> <tbody> <tr> <th>Name:</th> <td> Albert Einstein </td> </tr> <tr> <th>Respondent:</th> <td> Yes </td> </tr> <tr> <th>Age:</th> <td> 61 </td> </tr> <tr> <th>Estimated Birth Year:</th> <td> <span class=\"srchHit\"> <span title=\"Alternate values for this record\" class=\"altValue\">[abt 1879]</span> </span> <span title=\"This value was member submitted. Click to see details.\" class=\"altValue\"> [<button class=\"link correction\" data-tracking-event=\"content : correction clicked\">14 Mar 1879</button>] </span> </td> </tr> <tr> <th>Gender:</th> <td> Male </td> </tr> <tr> <th>Race:</th> <td> White </td> </tr> <tr> <th>Birthplace:</th> <td> Germany </td> </tr> <tr> <th>Marital Status:</th> <td> Widowed </td> </tr> <tr> <th>Relation to Head of House:</th> <td> Head </td> </tr> <tr> <th>Home in 1940:</th> <td> Princeton, Mercer, New Jersey </td> </tr> <tr> <th>Map of Home in 1940:</th> <td> <button type=\"button\" title=\"View map\" class=\"link mapLink\" data-modal-title=\"Princeton, Mercer, New Jersey\" data-place-names=\"Princeton,Mercer,New Jersey\" data-tracking-event=\"content : map link clicked\">Princeton, Mercer, New Jersey</button> </td> </tr> <tr> <th>Street:</th> <td> Mercer - Street </td> </tr> <tr> <th>House Number:</th> <td> 112 </td> </tr> <tr> <th>Farm:</th> <td> No </td> </tr> <tr> <th>Inferred Residence in 1935:</th> <td> Princeton, Mercer, New Jersey </td> </tr> <tr> <th>Residence in 1935:</th> <td> Princeton </td> </tr> <tr> <th>Resident on farm in 1935:</th> <td> No </td> </tr> <tr> <th>Citizenship:</th> <td> Having first papers </td> </tr> <tr> <th>Sheet Number:</th> <td> 10B </td> </tr> <tr> <th>Number of Household in Order of Visitation:</th> <td> 267 </td> </tr> <tr> <th>Occupation:</th> <td> Pychies Professor </td> </tr> <tr> <th>Industry:</th> <td> Private School </td> </tr> <tr> <th>House Owned or Rented:</th> <td> Owned </td> </tr> <tr> <th>Value of Home or Monthly Rental if Rented:</th> <td> 22000 </td> </tr> <tr> <th>Attended School or College:</th> <td> No </td> </tr> <tr> <th>Highest Grade Completed:</th> <td> College, 5th or subsequent year </td> </tr> <tr> <th>Hours Worked Week Prior to Census:</th> <td> 44 </td> </tr> <tr> <th>Class of Worker:</th> <td> Wage or salary worker in private work </td> </tr> <tr> <th>Weeks Worked in 1939:</th> <td> 52 </td> </tr> <tr> <th>Income:</th> <td> 5000 </td> </tr> <tr> <th>Income Other Sources:</th> <td> Yes </td> </tr> <tr> <th>Neighbors:</th> <td> <button type=\"button\" title=\"View others on page\" class=\"link neighborsLink\" data-modal-title=\"View others on page\" data-image-gid=\"m-t0627-02357-00675:2442\" data-tracking-event=\"content : neighbors link clicked\">View others on page</button> </td> </tr> </tbody> </table>"
}
],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ancestry.com/discoveryui-content/view/18443183:7884?tid=&pid=&queryId=283135001368664572d798e1a9012c06&_phsrc=oJW436&_phstart=successSource",
"items": [
{
"itemType": "bookSection",
"title": "Pauline Rosenboom",
"creators": [],
"date": "1910",
"archive": "Ancestry.com",
"bookTitle": "1910 United States Federal Census [Bronx Assembly District 34, New York, New York]",
"libraryCatalog": "Ancestry.com US Federal Census",
"pages": "4A (roll T624_1001)",
"publisher": "National Archives and Records Administration",
"url": "https://www.ancestry.com/discoveryui-content/view/18443183:7884",
"attachments": [
{
"title": "Census Record",
"mimeType": "image/jpeg"
}
],
"tags": [],
"notes": [
{
"note": "<table id=\"recordServiceData\" class=\"table tableHorizontal tableHorizontalRuled\"> <tbody> <tr> <th>Name:</th> <td> <span class=\"srchHit\">Pauline Rosenboom <span title=\"Alternate name for this record\" class=\"altValue\">[Pauline Rosenbaum]</span> </span> </td> </tr> <tr> <th>Age in 1910:</th> <td> 51 </td> </tr> <tr> <th>Birth Date:</th> <td> <span class=\"srchHit\">1859 <span title=\"Alternate date for this record\" class=\"altValue\">[1859]</span> </span> </td> </tr> <tr> <th>Birthplace:</th> <td> Austria </td> </tr> <tr> <th>Home in 1910:</th> <td> Bronx Assembly District 34, New York, New York, USA </td> </tr> <tr> <th>Street:</th> <td> est Clenton Ave </td> </tr> <tr> <th>Race:</th> <td> White </td> </tr> <tr> <th>Gender:</th> <td> Female </td> </tr> <tr> <th>Immigration Year:</th> <td> 1887 </td> </tr> <tr> <th>Relation to Head of House:</th> <td> Mother-in-law </td> </tr> <tr> <th>Marital Status:</th> <td> Widowed </td> </tr> <tr> <th>Father's Birthplace:</th> <td> Austria </td> </tr> <tr> <th>Mother's Birthplace:</th> <td> Austria </td> </tr> <tr> <th>Native Tongue:</th> <td> English </td> </tr> <tr> <th>Attended School:</th> <td> No </td> </tr> <tr> <th>Able to read:</th> <td> Yes </td> </tr> <tr> <th>Able to Write:</th> <td> Yes </td> </tr> <tr> <th>Number of Children Born:</th> <td> 7 </td> </tr> <tr> <th>Number of Children Living:</th> <td> 5 </td> </tr> <tr> <th>Neighbors:</th> <td> <button type=\"button\" title=\"View others on page\" class=\"link neighborsLink\" data-modal-title=\"View others on page\" data-image-gid=\"4450082_00484:7884\" data-tracking-event=\"content : neighbors link clicked\">View others on page</button> </td> </tr> </tbody> </table>"
}
],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -1,7 +1,7 @@
{
"translatorID": "5f22bd25-5b70-11e1-bb1d-c4f24aa18c1e",
"label": "Annual Reviews",
"creator": "Aurimas Vinckevicius",
"creator": "Aurimas Vinckevicius and Abe Jellinek",
"target": "^https?://[^/]*annualreviews\\.org(:[\\d]+)?(?=/)[^?]*(/(toc|journal|doi)/|showMost(Read|Cited)Articles|doSearch)",
"minVersion": "3.0",
"maxVersion": "",
@ -9,11 +9,11 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-01-01 15:19:19"
"lastUpdated": "2022-08-02 12:48:22"
}
/**
Copyright (c) 2012 Aurimas Vinckevicius
Copyright (c) 2012-2021 Aurimas Vinckevicius and Abe Jellinek
This program is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License
@ -30,35 +30,33 @@
<http://www.gnu.org/licenses/>.
*/
//add using BibTex
// add using BibTex
function addByBibTex(doi, tags) {
var baseUrl = 'http://www.annualreviews.org';
var risRequest = baseUrl + '/action/downloadCitation';
var articleUrl = baseUrl + '/doi/abs/' + doi;
var pdfUrl = baseUrl + '/doi/pdf/' + doi;
var postData = 'include=abs&direct=on&submit=Download+chapter+metadata&downloadFileName=citation' +
'&format=bibtex' + //bibtex
'&doi=' + encodeURIComponent(doi);
var postData = 'include=abs&direct=on&submit=Download+chapter+metadata&downloadFileName=citation'
+ '&format=bibtex' // bibtex
+ '&doi=' + encodeURIComponent(doi);
Zotero.Utilities.HTTP.doPost(risRequest, postData, function(text) {
Zotero.Utilities.HTTP.doPost(risRequest, postData, function (text) {
var translator = Zotero.loadTranslator('import');
translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4'); //bibtex
translator.setTranslator('9cb70025-a888-4a29-a210-93ec52da40d4'); // bibtex
translator.setString(text);
translator.setHandler('itemDone', function(obj, item) {
//title is sometimes in all caps
if (item.title == item.title.toUpperCase())
item.title = ZU.capitalizeTitle(item.title, true);
if (item.abstractNote){
item.abstractNote = item.abstractNote.replace(/^...?Abstract/, "")
translator.setHandler('itemDone', function (obj, item) {
// title is sometimes in all caps
if (item.title == item.title.toUpperCase()) item.title = ZU.capitalizeTitle(item.title, true);
if (item.abstractNote) {
item.abstractNote = item.abstractNote.replace(/^...?Abstract/, "");
}
//add tags
// add tags
if (tags) {
item.tags = tags;
}
//set PDF file
// set PDF file
item.attachments = [{
url: pdfUrl,
title: 'Full Text PDF',
@ -73,60 +71,52 @@ function addByBibTex(doi, tags) {
}
function detectWeb(doc, url) {
var title = doc.title.toLowerCase();
if ( url.match(/\/doi\/(abs|full|pdf)\//) ) {
if (/\/doi\/(abs|full|pdf|10\.)/.test(url)) {
return 'journalArticle';
} else if ( title.match('- table of contents -') ||
title.match('- most downloaded reviews') ||
title.match('- most cited reviews') ||
title.match('- forthcoming -') ||
title.match('search results') ||
url.match('/journal/') ) { //individual journal home page
}
else if (getSearchResults(doc, true)) {
return 'multiple';
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.articleBoxWrapper');
if (!rows.length) rows = doc.querySelectorAll('.teaser');
for (let row of rows) {
let doi = attr(row, 'input[name="doi"]', 'value');
if (!doi) doi = ZU.cleanDOI(attr(row, 'h2 > a', 'href'));
let title = ZU.trimInternal(text(row, 'h2 > a'));
if (!doi || !title) continue;
if (checkOnly) return true;
found = true;
items[doi] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if ( detectWeb(doc, url) == 'multiple' ) {
var articles = Zotero.Utilities.xpath(doc, '//div[@class="articleBoxWrapper"]');
var selectList = new Object();
var doi, title, article;
for ( var i in articles ) {
article = articles[i];
doi = Zotero.Utilities.xpath(article, './div[@class="articleCheck"]/input');
title = Zotero.Utilities.xpathText(article, './div[@class="articleBoxMeta"]/h2/a');
if ( doi && doi[0].value && title) {
selectList[doi[0].value] = title;
}
}
Zotero.selectItems(selectList, function(selectedItems) {
if (selectedItems == null) return true;
for (var item in selectedItems) {
addByBibTex(item);
}
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) Object.keys(items).forEach(addByBibTex);
});
} else {
var match = url.match(/\/(?:abs|full|pdf)\/([^?]+)/);
if (match) {
//get keywords before we leave
var tags, keywords = ZU.xpath(doc,
'//form[@id="frmQuickSearch"]\
/div[@class="pageTitle" and contains(text(), "KEYWORD")]\
/following-sibling::div/span[@class="data"]');
if (keywords) {
tags = new Array();
for (var i=0, n=keywords.length; i<n; i++) {
tags.push(keywords[i].textContent.trim());
}
}
}
else {
scrape(doc, url);
}
}
addByBibTex(match[1], tags);
}
function scrape(doc, url) {
// match both /doi/abs/10.1146 (etc.) and /doi/10.1146
var match = url.match(/\/(?:doi)\/(?:abs|full|pdf)?\/?([^?]+)/);
if (match) {
let tags = attr(doc, 'meta[name="dc.Subject"]', 'content')
.split('; ')
.map(tag => ({ tag }));
addByBibTex(match[1], tags);
}
}
@ -159,7 +149,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.annualreviews.org/doi/abs/10.1146/annurev.biophys.29.1.545?prevSearch=&searchHistoryKey=",
"url": "https://www.annualreviews.org/doi/abs/10.1146/annurev.biophys.29.1.545?prevSearch=&searchHistoryKey=",
"items": [
{
"itemType": "journalArticle",
@ -190,7 +180,7 @@ var testCases = [
"libraryCatalog": "Annual Reviews",
"pages": "545-576",
"publicationTitle": "Annual Review of Biophysics and Biomolecular Structure",
"url": "http://dx.doi.org/10.1146/annurev.biophys.29.1.545",
"url": "https://doi.org/10.1146/annurev.biophys.29.1.545",
"volume": "29",
"attachments": [
{
@ -199,11 +189,21 @@ var testCases = [
}
],
"tags": [
"ADF/cofilins",
"Arp2/3 complex",
"WASp",
"cell motility",
"profilin"
{
"tag": "ADF/cofilins"
},
{
"tag": "Arp2/3 complex"
},
{
"tag": "WASp"
},
{
"tag": "cell motility"
},
{
"tag": "profilin"
}
],
"notes": [],
"seeAlso": []
@ -214,6 +214,116 @@ var testCases = [
"type": "web",
"url": "http://www.annualreviews.org/toc/anchem/5/1",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.annualreviews.org/toc/linguistics/current",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.annualreviews.org/doi/abs/10.1146/annurev-linguistics-081720-111352",
"items": [
{
"itemType": "journalArticle",
"title": "Linguistics Then and Now: Some Personal Reflections",
"creators": [
{
"firstName": "Noam",
"lastName": "Chomsky",
"creatorType": "author"
}
],
"date": "2021",
"DOI": "10.1146/annurev-linguistics-081720-111352",
"abstractNote": "By mid-twentieth century, a working consensus had been reached in the linguistics community, based on the great achievements of preceding years. Synchronic linguistics had been established as a science, a “taxonomic” science, with sophisticated procedures of analysis of data. Taxonomic science has limits. It does not ask “why?” The time was ripe to seek explanatory theories, using insights provided by the theory of computation and studies of explanatory depth. That effort became the generative enterprise within the biolinguistics framework. Tensions quickly arose: The elements of explanatory theories (generative grammars) were far beyond the reach of taxonomic procedures. The structuralist principle that language is a matter of training and habit, extended by analogy, was unsustainable. More generally, the mood of “virtually everything is known” became “almost nothing is understood,” a familiar phenomenon in the history of science, opening a new and exciting era for a flourishing discipline.",
"issue": "1",
"itemID": "doi:10.1146/annurev-linguistics-081720-111352",
"libraryCatalog": "Annual Reviews",
"pages": "1-11",
"publicationTitle": "Annual Review of Linguistics",
"shortTitle": "Linguistics Then and Now",
"url": "https://doi.org/10.1146/annurev-linguistics-081720-111352",
"volume": "7",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "autobiography"
},
{
"tag": "biolinguistics program"
},
{
"tag": "explanatory linguistic theory"
},
{
"tag": "explanatory theories"
},
{
"tag": "generative enterprise"
},
{
"tag": "history of linguistics"
},
{
"tag": "history of science"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.annualreviews.org/doi/10.1146/annurev-physchem-040513-103712",
"items": [
{
"itemType": "journalArticle",
"title": "Phase Separation in Bulk Heterojunctions of Semiconducting Polymers and Fullerenes for Photovoltaics",
"creators": [
{
"firstName": "Neil D.",
"lastName": "Treat",
"creatorType": "author"
},
{
"firstName": "Michael L.",
"lastName": "Chabinyc",
"creatorType": "author"
}
],
"date": "2014",
"DOI": "10.1146/annurev-physchem-040513-103712",
"abstractNote": "Thin-film solar cells are an important source of renewable energy. The most efficient thin-film solar cells made with organic materials are blends of semiconducting polymers and fullerenes called the bulk heterojunction (BHJ). Efficient BHJs have a nanoscale phase-separated morphology that is formed during solution casting. This article reviews recent work to understand the nature of the phase-separation process resulting in the formation of the domains in polymer-fullerene BHJs. The BHJ is now viewed as a mixture of polymer-rich, fullerene-rich, and mixed polymer-fullerene domains. The formation of this structure can be understood through fundamental knowledge of polymer physics. The implications of this structure for charge transport and charge generation are given.",
"extra": "PMID: 24689796",
"issue": "1",
"itemID": "doi:10.1146/annurev-physchem-040513-103712",
"libraryCatalog": "Annual Reviews",
"pages": "59-81",
"publicationTitle": "Annual Review of Physical Chemistry",
"url": "https://doi.org/10.1146/annurev-physchem-040513-103712",
"volume": "65",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "organic electronics"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View File

@ -9,13 +9,13 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-11-11 15:26:37"
"lastUpdated": "2021-09-22 19:39:49"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2017 Velősy Péter Kristóf
Copyright © 2017-2021 Velősy Péter Kristóf
This file is part of Zotero.
@ -36,16 +36,14 @@
*/
//Zotero attr() and text() functions:
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
function detectWeb(doc, url) {
if (url.includes('konyv')) {
return "book";
} else if (url.includes('index.php?type=search') && getSearchResults(doc, true)){
}
else if (url.includes('index.php?type=search') && getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
@ -53,9 +51,9 @@ function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.src-result-book');
for (var i=0; i<rows.length; i++) {
var href = attr(rows[i], '#searchResultKonyv-csempes', 'href');
var title = ZU.trimInternal(text(rows[i], '.book-title-src'));
for (let row of rows) {
var href = attr(row, '#searchResultKonyv-csempes', 'href');
var title = ZU.trimInternal(text(row, '.book-title-src'));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
@ -68,22 +66,16 @@ function getSearchResults(doc, checkOnly) {
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
} else {
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
function scrape(doc, _url) {
var newItem = new Zotero.Item('book');
newItem.title = text(doc, '[itemprop=name]', 0).trim();
@ -108,24 +100,22 @@ function scrape(doc, url) {
newItem.volume = newItem.seriesNumber;
}
var publisherElement = doc.querySelector('[itemprop=publisher]');
if (publisherElement) {
var publisherName = text(publisherElement, '[itemprop=name]', 0);
if (publisherName) {
newItem.publisher = publisherName;
}
var publisherPlace = text(publisherElement, '[itemprop=address]', 0);
if (publisherPlace) {
newItem.place = publisherPlace.replace('(', '').replace(')', '');
}
var publisherName = text(doc, '#konyvAdatlapKiadoLink [itemprop=name]')
|| text(doc, '[itemprop=name]', 1);
if (publisherName) {
newItem.publisher = publisherName;
}
newItem.date = text(doc, '[itemprop=datePublished]');
newItem.numPages = text(doc, '[itemprop=numberOfPages]', 0);
var publisherPlace = firstText(doc, '[itemprop=address]');
if (publisherPlace) {
newItem.place = publisherPlace.replace('(', '').replace(')', '');
}
newItem.date = firstText(doc, '[itemprop=datePublished]');
newItem.numPages = firstText(doc, '[itemprop=numberOfPages]');
newItem.language = text(doc, '[itemprop=inLanguage]', 0);
newItem.language = firstText(doc, '[itemprop=inLanguage]');
var isbnElement = getElementByInnerText(doc, 'th', 'ISBN:');
if (isbnElement) {
@ -134,14 +124,26 @@ function scrape(doc, url) {
var contentsElement = doc.getElementById('tartalomFull');
if (contentsElement) {
newItem.notes.push({note: contentsElement.innerText});
newItem.notes.push({ note: contentsElement.innerText });
}
newItem.attachments.push({document: doc, title: "Antikvarium.hu Snapshot", mimeType: "text/html" });
newItem.attachments.push({ document: doc, title: "Antikvarium.hu Snapshot", mimeType: "text/html" });
newItem.complete();
}
/**
* Return the first element matching the selector with non-empty text.
*/
function firstText(docOrElem, selector) {
for (let elem of docOrElem.querySelectorAll(selector)) {
let elemText = elem.textContent.trim();
if (elemText) return elemText;
}
return '';
}
function getElementByInnerText(doc, elementType, innerText) {
var tags = doc.getElementsByTagName(elementType);
@ -156,7 +158,8 @@ function getElementByInnerText(doc, elementType, innerText) {
function cleanHungarianAuthor(authorName) {
if (authorName.includes(',')) {
return Zotero.Utilities.cleanAuthor(authorName, 'author', true);
} else {
}
else {
var author = Zotero.Utilities.cleanAuthor(authorName, 'author', false);
var firstName = author.lastName;
var lastName = author.firstName;
@ -169,7 +172,7 @@ function cleanHungarianAuthor(authorName) {
function capitalizeHungarianTitle(title) {
title = title[0].toUpperCase() + title.substring(1).toLowerCase();
var words = title.split(/[ !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/);
words.forEach(w => {
words.forEach((w) => {
if (isRomanNumeral(w)) {
title = title.replace(w, w.toUpperCase());
}
@ -179,8 +182,9 @@ function capitalizeHungarianTitle(title) {
function isRomanNumeral(word) {
var romanRegex = /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/;
return word.toUpperCase().match(romanRegex) ? true : false;
return !!word.toUpperCase().match(romanRegex);
}
/** BEGIN TEST CASES **/
var testCases = [
{
@ -224,6 +228,53 @@ var testCases = [
"type": "web",
"url": "https://www.antikvarium.hu/index.php?type=search&ksz=atlasz&reszletes=0&newSearch=1&searchstart=ksz&interfaceid=101",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.antikvarium.hu/konyv/peter-harrison-mary-harrison-misztikus-erok-51027-0",
"items": [
{
"itemType": "book",
"title": "Misztikus erők: Mistic forces/testen túli tapasztalatok",
"creators": [
{
"firstName": "Harrison",
"lastName": "Peter",
"creatorType": "author"
},
{
"firstName": "Harrison",
"lastName": "Mary",
"creatorType": "author"
},
{
"firstName": "Nóra",
"lastName": "Rohonczi",
"creatorType": "author"
}
],
"ISBN": "9789637994043",
"language": "Magyar",
"libraryCatalog": "Antikvarium.hu",
"numPages": "274",
"place": "Budapest",
"publisher": "Pesti Szalon Könyvkiadó",
"shortTitle": "Misztikus erők",
"attachments": [
{
"title": "Antikvarium.hu Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [
{
"note": "TARTALOM\nKöszönetnyilvánítás\t3\nElőszó\t5\nBevezetés\t9\nMi a TTT?\t13\nA fény\t23\nA magaslati nézőpont\t35\nA mennyországban?\t49\nA gyógyító erő\t55\nKülönös hatóerők\t75\nÁllatok\t91\nZene\t105\nA határterület\t111\nIdőutazások\t121\nA döntés\t141\nAz ezüstzsinór\t151\nEgybeesések\t163\nA fátum\t173\nMenekülés\t193\nGyermekek\t201\nA halálfélelem legyőzése\t213\nMegérzések\t231\nAz okkultizmus veszélyei\t235\nA lélek illata\t247\nAngyalok\t257\nPozitív végkövetkeztetések\t273"
}
],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

390
AquaDocs.js Normal file
View File

@ -0,0 +1,390 @@
{
"translatorID": "97b65138-71b7-424f-b305-4a2161e90661",
"label": "AquaDocs",
"creator": "Sebastian Karcher",
"target": "^https?://aquadocs\\.org/(handle|discover|browse)",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-08-24 02:41:29"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2023 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.includes('/handle/') && attr(doc, 'meta[name="DC.type"]', 'content')) {
let type = attr(doc, 'meta[name="DC.type"]', 'content');
// Z.debug(type);
return getType(type);
}
else if (getSearchResults(doc, true)) {
return 'multiple';
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('.main-content .description-content a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
async function doWeb(doc, url) {
if (detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(url);
}
}
else {
await scrape(url);
}
}
function getType(string) {
string = string.toLowerCase();
if (string.includes("book_section") || string.includes("chapter")) {
return "bookSection";
}
else if (string.includes("book") || string.includes("monograph")) {
return "book";
}
else if (string.includes("report")) {
return "report";
}
else if (string.includes("proceedings") || string.includes("conference")) {
return "conferencePaper";
}
else {
return "journalArticle"; // default -- most of the catalog
}
}
async function scrape(url) {
let xmlURL = url.replace("/handle/", "/metadata/handle/").replace(/[?#].*$/, "") + "/mets.xml";
// Z.debug(xmlURL);
let xmlText = await requestText(xmlURL);
// Z.debug(xmlText)
let translator = Zotero.loadTranslator('import');
translator.setTranslator('2c05e2d1-a533-448f-aa20-e919584864cb'); // DIM
translator.setString(xmlText);
translator.setHandler('itemDone', (_obj, item) => {
for (let attachment of item.attachments) {
if (attachment.url && !attachment.url.startsWith("http")) {
attachment.url = "https://aquadocs.org" + attachment.url;
}
}
item.complete();
});
await translator.translate();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://aquadocs.org/handle/1834/42391",
"items": [
{
"itemType": "journalArticle",
"title": "Upwelling phenomenon in the marine regions of Southern Central of Vietnam: a review",
"creators": [
{
"firstName": "Hong Long",
"lastName": "Bui",
"creatorType": "author"
},
{
"firstName": "Minh Thu",
"lastName": "Phan",
"creatorType": "author"
}
],
"date": "2022",
"ISSN": "1859-3097",
"abstractNote": "Upwelling is an oceanographic phenomenon that involves the physical process and contributes to changes in chemistry, biology, and natural resources. So, systematically, it is the particular ecosystems of whole marine regions with the upwelling. The strong upwelling waters in South Central Regions of Vietnam have uncertain features of the East Vietnam Sea (Bien Dong) and special characteristics of a coastal upwelling area, recorded in international scientific papers in the twentieth century. Their first signals were discovered in the early 1930s through conceptual ideas. The upwelling phenomenon is officially confirmed by scientific results of marine investigations of the NAGA Expedition (19591961). The paper aims to review and discuss the physical from Vietnamese investigation and results since 1990s. The following factors are the most contributing to forming and developing the strong upwelling in Southern Central Waters: (1) Influence scale (Mezo- and micro-scale); (2) Forming causes and developing mechanism of upwelling phenomenon, such as monsoon, morphography, shoreline, and western boundary current system of the East Vietnam Sea; (3) Influence of the water-mass from Mekong River on the upwelling area; (4) Ecological environmental consequences; (5) Impacts of the atmospheric-oceanic interaction processes on the western EVS on upwelling. Additionally, the review has targeted findings of upwelling phenomenon mainly in Vietnamese waters based on remote sensing analysis and reanalysis data series to simulate their forming, mechanizing, fluctuating models and the impacts of upwelling in the EVS on resources and ecosystems. The coupled atmosphere-ocean models resulted the upwelling mechanisms and formation. The long-time series of upwelling phenomenon (Macroscale) were evaluated by remote sensing and reanalyzed data series. It is also providing the supplementing and detailing causes and mechanisms of upwelling formation; impacts and interactions of upwelling on marine physics and hydrodynamics (ocean vortexes, seawater temperature), biochemical (nutrients, plankton organisms), and resources (fish, seafood). Within the framework of strong upwelling waters in the Southern Central Regions (Vietnam), the review has not only mentioned partly clarified scientific results but also indicates the limitations and challenges which were faced and encountered in the forecasters of upwelling phenomena in the future.",
"issue": "2",
"language": "en",
"libraryCatalog": "AquaDocs",
"pages": "103-122",
"publicationTitle": "Vietnam of Journal Marine Science and Technology",
"shortTitle": "Upwelling phenomenon in the marine regions of Southern Central of Vietnam",
"url": "http://hdl.handle.net/1834/42391",
"volume": "22",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Natural resources"
},
{
"tag": "Upwelling phenomenon"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://aquadocs.org/handle/1834/20117?show=full",
"items": [
{
"itemType": "book",
"title": "M/V CONNECTED Coral Reef Restoration Monitoring Report, Monitoring Events 2004-2005. Florida Keys National Marine Sanctuary Monroe County, Florida",
"creators": [
{
"firstName": "Joe",
"lastName": "Schittone",
"creatorType": "author"
},
{
"firstName": "Erik C.",
"lastName": "Franklin",
"creatorType": "author"
},
{
"firstName": "J. Harold",
"lastName": "Hudson",
"creatorType": "author"
},
{
"firstName": "Jeff",
"lastName": "Anderson",
"creatorType": "author"
}
],
"date": "2006",
"abstractNote": "This document presents the results of the monitoring of a repaired coral reef injured by the M/V Connected vessel grounding incident of March 27, 2001. This groundingoccurred in Florida state waters within the boundaries of the Florida Keys National Marine Sanctuary (FKNMS). The National Oceanic and Atmospheric Administration (NOAA) and the Board of Trustees of the Internal Improvement Trust Fund of the State of Florida, (“State of Florida” or “state”) are the co-trustees for the natural resourceswithin the FKNMS and, thus, are responsible for mediating the restoration of the damaged marine resources and monitoring the outcome of the restoration actions. Therestoration monitoring program tracks patterns of biological recovery, determines the success of restoration measures, and assesses the resiliency to environmental andanthropogenic disturbances of the site over time.The monitoring program at the Connected site was to have included an assessment of the structural stability of installed restoration modules and biological condition of reattached corals performed on the following schedule: immediately (i.e., baseline), 1, 3, and 6 years after restoration and following a catastrophic event. Restoration of this site was completed on July 20, 2001. Due to unavoidable delays in the settlement of the case, the“baseline” monitoring event for this site occurred in July 2004. The catastrophic monitoring event occurred on August 31, 2004, some 2 ½ weeks after the passage of Hurricane Charley which passed nearby, almost directly over the Dry Tortugas. In September 2005, the year one monitoring event occurred shortly after the passage of Hurricane Katrina, some 70 km to the NW. This report presents the results of all three monitoring events. (PDF contains 37 pages.)",
"language": "en",
"libraryCatalog": "AquaDocs",
"place": "Silver Spring, MD",
"publisher": "NOAA/National Ocean Service/National Marine Sanctuary Program",
"series": "Marine Sanctuaries Conservation Series",
"url": "http://hdl.handle.net/1834/20117",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Acropora palmata"
},
{
"tag": "Coral"
},
{
"tag": "Ecology"
},
{
"tag": "Environment"
},
{
"tag": "Florida Keys National Marine Sanctuary"
},
{
"tag": "Grounding"
},
{
"tag": "Hurricane Charley"
},
{
"tag": "Hurricane Katrina"
},
{
"tag": "Management"
},
{
"tag": "Monitoring"
},
{
"tag": "Restoration"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://aquadocs.org/discover",
"items": "multiple"
},
{
"type": "web",
"url": "https://aquadocs.org/browse?type=subject&value=A.+gueldenstaedtii",
"items": "multiple"
},
{
"type": "web",
"url": "https://aquadocs.org/handle/1834/30052?show=full",
"items": [
{
"itemType": "bookSection",
"title": "Ecological Attribute Alteration: Measurement and Evaluation: Activity Assessment Routine: Ecological Systems Component, Ecological Systems Component Handbook",
"creators": [],
"date": "1978-08",
"abstractNote": "This technical paper is intended to provide a more complete treatment of implicit principles and assumptions contained in the user's manual for the ecological systems component of the activity assessment routine. The ecological systems component (ESC) defines a method for evaluating changes in an ecosystem which may result from resource use and consumption. This paper begins by characterizing an ecosystem as an organized collection of attributes mutually dependent on energy exchange. The magnitude matrix with which altered energy flows are scaled is described in Chapter 4. The magnitude of an alteration is assessed somewhat differently for the two categories of attributes: discussion of conventions relevant to this distinction is provided in Chapter 5. However, effects on attributes are variable through time, and additional remarks concerning duration are included in Chapter 6. Finally, possible exceptions to the general guidelines for designating the direction of an effect are introduced in Chapter 7.",
"bookTitle": "Ecological Systems Component Handbook",
"language": "en",
"libraryCatalog": "AquaDocs",
"place": "Austin, TX",
"publisher": "RPC, Inc.",
"series": "Technical Paper",
"shortTitle": "Ecological Attribute Alteration",
"url": "http://hdl.handle.net/1834/30052",
"attachments": [],
"tags": [
{
"tag": "Ecology"
},
{
"tag": "Management"
},
{
"tag": "coastal zone management"
},
{
"tag": "ecological assessment"
},
{
"tag": "evaluation"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://aquadocs.org/handle/1834/970?show=full",
"items": [
{
"itemType": "conferencePaper",
"title": "Report from the WPB on the Data Situation for Billfish",
"creators": [],
"date": "2000",
"conferenceName": "IOTC 3",
"language": "en",
"libraryCatalog": "AquaDocs",
"pages": "102-103",
"proceedingsTitle": "IOTC Proceedings no. 3",
"publisher": "IOTC",
"url": "http://hdl.handle.net/1834/970",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Billfisheries"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://aquadocs.org/handle/1834/31638?show=full",
"items": [
{
"itemType": "conferencePaper",
"title": "Introduction",
"creators": [
{
"firstName": "Caroline M.",
"lastName": "Isaacs",
"creatorType": "author"
}
],
"date": "1997",
"abstractNote": "The Thirteenth Annual PACLIM Workshop was held at the Asilomar Conference Center on April 14-17, 1996. Attended by about 100 registered participants, the workshop included 27 talks and 26 poster presentations. The talks consisted of a one-day theme session of seven 45-minute talks and two featured evening talks. Throughout the remainder of the meeting were nearly 20 shorter, 20-minute presentations. Poster presenters gave a short 1-2 minute introduction to their posters, which were displayed during the entire meeting.All presenters were invited to expand their abstracts into a manuscript for inclusion in the Proceedings volume, and nearly all presentations are included in manuscript or abstract form. In this Proceedings volume, manuscripts are presented first, and abstracts of talks and then posters follow.",
"conferenceName": "Thirteenth Annual Pacific Climate (PACLIM) Workshop",
"language": "en",
"libraryCatalog": "AquaDocs",
"pages": "1-8",
"url": "http://hdl.handle.net/1834/31638",
"attachments": [
{
"title": "Full Text PDF",
"mimeType": "application/pdf"
}
],
"tags": [
{
"tag": "Atmospheric Sciences"
},
{
"tag": "Earth Sciences"
},
{
"tag": "Ecology"
},
{
"tag": "Limnology"
},
{
"tag": "Oceanography"
},
{
"tag": "PACLIM"
},
{
"tag": "hydrology"
}
],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-03-09 12:23:02"
"lastUpdated": "2021-12-27 20:43:34"
}
/*
@ -54,62 +54,59 @@ var metaTags = {
};
function doWeb(doc, url) {
var articles = [];
if (detectWeb(doc, url) == "multiple") {
var items = Zotero.Utilities.getItemArray(doc, doc, /sic_\d+|tel-\d+/);
items = Zotero.selectItems(items);
for (var i in items) {
articles.push(i);
}
Zotero.selectItems(items, function (items) {
if (!items) return;
ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
articles = [url];
scrape(doc);
}
Zotero.Utilities.processDocuments(articles, function (doc) {
var xpath = '//meta[@name]';
var data = {};
var metas = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
var meta;
}
function scrape(doc) {
var xpath = '//meta[@name]';
var data = {};
var metas = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
var meta;
meta = metas.iterateNext();
while (meta) {
if (data[meta.name]) {
data[meta.name] = data[meta.name] + ";" + meta.content;
}
else {
data[meta.name] = meta.content;
}
meta = metas.iterateNext();
while (meta) {
if (data[meta.name]) {
data[meta.name] = data[meta.name] + ";" + meta.content;
}
else {
data[meta.name] = meta.content;
}
meta = metas.iterateNext();
}
}
var item = new Zotero.Item("journalArticle");
for (var tag in metaTags) {
if (tag == "DC.creator") {
var authors = data['DC.creator'].split(";");
for (var i = 0; i < authors.length; i++) {
var aut = authors[i];
aut = aut.replace(/^([^,]+),\s+(.*)$/, "$2 $1");
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
}
}
else {
item[metaTags[tag]] = data[tag];
var item = new Zotero.Item("journalArticle");
for (var tag in metaTags) {
if (tag == "DC.creator") {
var authors = data['DC.creator'].split(";");
for (var i = 0; i < authors.length; i++) {
var aut = authors[i];
aut = aut.replace(/^([^,]+),\s+(.*)$/, "$2 $1");
item.creators.push(Zotero.Utilities.cleanAuthor(aut, "author"));
}
}
var pdfurl = data.citation_pdf_url;
if (pdfurl) {
item.attachments = [
{ url: item.url, title: "AOSIC Snapshot", mimeType: "text/html" },
{ url: pdfurl, title: "AOSIC Full Text PDF", mimeType: "application/pdf" }
];
else {
item[metaTags[tag]] = data[tag];
}
item.complete();
}, function () {
Zotero.done();
});
Zotero.wait();
}
var pdfurl = data.citation_pdf_url;
if (pdfurl) {
item.attachments = [
{ url: item.url, title: "AOSIC Snapshot", mimeType: "text/html" },
{ url: pdfurl, title: "AOSIC Full Text PDF", mimeType: "application/pdf" }
];
}
item.complete();
}/** BEGIN TEST CASES **/
var testCases = [
{

View File

@ -1,175 +0,0 @@
{
"translatorID": "d9a16cf3-8b86-4cab-8610-dbd913ad1a44",
"label": "Archives Canada-France",
"creator": "Adam Crymble",
"target": "^https?://bd\\.archivescanadafrance\\.org",
"minVersion": "1.0.0b4.r5",
"maxVersion": "",
"priority": 100,
"browserSupport": "gcsibv",
"inRepository": true,
"translatorType": 4,
"lastUpdated": "2012-01-01 01:42:16"
}
function detectWeb(doc, url) {
if (doc.location.href.match("doc.xsp?")) {
return "book";
} else if (doc.evaluate('//li/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "multiple";
} else if (doc.evaluate('//td[1][@class="icones"]/a', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
return "multiple";
}
}
function associateData (newItem, dataTags, field, zoteroField) {
if (dataTags[field]) {
newItem[zoteroField] = dataTags[field];
}
}
function scrape(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var dataTags = new Object();
var tagsContent = new Array();
var fieldTitle;
var newItem = new Zotero.Item("book");
var xPathHeaders = '//td[2]/div[@class="ead-c"]/div[@class="ead-did"]/table[@class="ead-did"]/tbody/tr/td[1]';
if (doc.evaluate(xPathHeaders, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var headers = doc.evaluate(xPathHeaders, doc, nsResolver, XPathResult.ANY_TYPE, null);
var contents = doc.evaluate('//td[2][@class="did-content"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
while (fieldTitle = headers.iterateNext()) {
fieldTitle = fieldTitle.textContent.replace(/\s+/g, '');
if (fieldTitle == "Origination" || fieldTitle == "Origine") {
fieldTitle = "Origination";
}
dataTags[fieldTitle] = Zotero.Utilities.cleanTags(contents.iterateNext().textContent.replace(/^\s*|\s*$/g, ''));
}
if (dataTags["Origination"]) {
var author = dataTags["Origination"];
if (!author.match(", ")) {
newItem.creators.push({lastName: author, creatorType: "author"});
} else {
var authors = author.split(", ");
author = authors[1] + " " + authors[0];
newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author"));
}
}
}
if (doc.evaluate('//h1[@class="doc-title"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.title = doc.evaluate('//h1[@class="doc-title"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
} else if (doc.evaluate('//td[2]/div[@class="notice"]/p', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
newItem.title = doc.evaluate('//td[2]/div[@class="notice"]/p', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
} else {
newItem.title = doc.title + " Title Not Found";
}
associateData (newItem, dataTags, "PhysicalDescription", "pages");
associateData (newItem, dataTags, "Descriptionmatérielle", "pages");
associateData (newItem, dataTags, "Repository", "repository");
associateData (newItem, dataTags, "Lieudeconservation", "repository");
associateData (newItem, dataTags, "LanguageoftheMaterial", "language");
associateData (newItem, dataTags, "Langue", "language");
associateData (newItem, dataTags, "Identifier", "callNumber");
associateData (newItem, dataTags, "Cote", "callNumber");
associateData (newItem, dataTags, "Datesextrêmes", "date");
associateData (newItem, dataTags, "Dates", "date");
newItem.url = doc.location.href;
newItem.complete();
}
function doWeb(doc, url) {
var namespace = doc.documentElement.namespaceURI;
var nsResolver = namespace ? function(prefix) {
if (prefix == 'x') return namespace; else return null;
} : null;
var articles = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = new Object();
if (doc.evaluate('//td[1][@class="icones"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var titles = doc.evaluate('//td[2][@class="ressource"]', doc, nsResolver, XPathResult.ANY_TYPE, null);
var titlesCount = doc.evaluate('count (//td[2][@class="ressource"])', doc, nsResolver, XPathResult.ANY_TYPE, null);
var links = doc.evaluate('//td[1][@class="icones"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
var next_link;
for (var i = 0; i < titlesCount.numberValue; i++) {
next_link = links.iterateNext().href;
if (!next_link.match("doc.xsp")) {
next_link = links.iterateNext().href;
}
items[next_link] = titles.iterateNext().textContent;
}
}
if (doc.evaluate('//li/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var titles = doc.evaluate('//li/a', doc, nsResolver, XPathResult.ANY_TYPE, null);
var next_title;
while (next_title = titles.iterateNext()) {
items[next_title.href] = next_title.textContent;
}
}
items = Zotero.selectItems(items);
for (var i in items) {
articles.push(i);
}
} else if (doc.evaluate('//div[@class="ancestor"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) {
var link = doc.evaluate('//div[@class="ancestor"]/a', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().href;
articles = [link];
} else {
articles = [url]
}
Zotero.Utilities.processDocuments(articles, scrape, function() {Zotero.done();});
Zotero.wait();
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://bd.archivescanadafrance.org/sdx-222-acf-pleade-2/acf/search-acf.xsp?sq1=montreal&fi1=fulltext&sq2=&fi2=fulltext&sq3=&fi3=fulltext&ed=&dbeg=&dend=&frepo=&forig=&x=0&y=0#resume",
"items": "multiple"
},
{
"type": "web",
"url": "http://bd.archivescanadafrance.org/sdx-222-acf-pleade-2/acf/doc.xsp?id=CAANQ_PISTARD_03Q808_392_CAANQ_PISTARD_03Q808_392&qid=sdx_q0&fmt=tab&base=fa&n=5&root=CAANQ_PISTARD_03Q808_392&ss=true&as=&ai=&from=",
"items": [
{
"itemType": "book",
"creators": [],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"title": "Fonds Intendants",
"url": "http://bd.archivescanadafrance.org/sdx-222-acf-pleade-2/acf/doc.xsp?id=ANQ_00001_intendants&fmt=tab&base=fa&root=CAANQ_PISTARD_03Q808_392&n=5&qid=sdx_q0&ss=true&as=&ai=",
"libraryCatalog": "Archives Canada-France",
"accessDate": "CURRENT_TIMESTAMP"
}
]
}
]
/** END TEST CASES **/

203
Ariana News.js Normal file
View File

@ -0,0 +1,203 @@
{
"translatorID": "44552245-d911-4613-8b4f-19f41a5e5b0d",
"label": "Ariana News",
"creator": "Abe Jellinek",
"target": "^https://ariananews\\.af/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-16 15:20:38"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.body.classList.contains('single')) {
return "newspaperArticle";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('ul.mvp-blog-story-list li a');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(text(row, 'h2'));
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
item.tags = item.tags.filter(tag => tag != 'featured' && tag != 'acci');
if (item.abstractNote) {
item.abstractNote = item.abstractNote.replace(/^\([^)]+\)/, '');
}
if (item.creators.length == 1 && item.creators[0].lastName == 'News') {
item.creators = [];
}
item.date = attr(doc, '[itemprop="datePublished"]', 'datetime');
item.publicationTitle = 'Ariana News';
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = "newspaperArticle";
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://ariananews.af/afghan-carpet-industry-facing-major-challenges-acci/",
"items": [
{
"itemType": "newspaperArticle",
"title": "Afghan carpet industry facing major challenges: ACCI",
"creators": [],
"date": "2021-07-26",
"abstractNote": "Afghanistans Chamber of Commerce and Investment (ACCI) said on Sunday that the Afghan carpet industry is facing numerous challenges despite the foreign aid that has been injected into the industry. The ACCI said that the lack of a dedicated industrial park and a suitable place to produce carpets are a […]",
"language": "en-US",
"libraryCatalog": "ariananews.af",
"publicationTitle": "Ariana News",
"shortTitle": "Afghan carpet industry facing major challenges",
"url": "https://ariananews.af/afghan-carpet-industry-facing-major-challenges-acci/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "carpet"
},
{
"tag": "export"
},
{
"tag": "kabul"
},
{
"tag": "production"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ariananews.af/us-troops-arrive-in-kabul-to-assist-with-evacuations/",
"items": [
{
"itemType": "newspaperArticle",
"title": "US troops arrive in Kabul to assist with evacuations",
"creators": [],
"date": "2021-08-14",
"abstractNote": "American troops have flown into Kabul to help evacuate embassy personnel and other civilians in the Afghan capital, a U.S. official said on Saturday, a day after Taliban insurgents seized the countrys second- and third-biggest cities. The Pentagon has said two battalions of Marines and one infantry battalion will arrive […]",
"language": "en-US",
"libraryCatalog": "ariananews.af",
"publicationTitle": "Ariana News",
"url": "https://ariananews.af/us-troops-arrive-in-kabul-to-assist-with-evacuations/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
{
"tag": "attacsk"
},
{
"tag": "doha"
},
{
"tag": "embassy"
},
{
"tag": "peace"
},
{
"tag": "taliban"
},
{
"tag": "troops"
},
{
"tag": "us"
},
{
"tag": "violence"
}
],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://ariananews.af/?s=covid",
"items": "multiple"
}
]
/** END TEST CASES **/

279
Art Institute of Chicago.js Normal file
View File

@ -0,0 +1,279 @@
{
"translatorID": "8e98b11a-5648-42b2-8542-5f366cb953f6",
"label": "Art Institute of Chicago",
"creator": "nikhil trivedi, Illya Moskvin",
"target": "^https?://(www\\.)?artic\\.edu/(artworks/|collection)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-06-04 20:08:22"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Art Institute of Chicago
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc) {
if (ZU.xpathText(doc, '//html[contains(@class, "p-artwork-show")]')) {
return 'artwork';
}
else if (ZU.xpathText(doc, '//html[contains(@class, "p-collection-index")]')) {
return 'multiple';
}
return false;
}
function doWeb(doc) {
if (detectWeb(doc) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
return true;
});
} else {
scrape(doc);
}
}
function scrape(doc) {
var item = new Zotero.Item('artwork');
item.title = ZU.xpathText(doc, '//h1');
var artists = ZU.xpath(doc, '//meta[contains(@name, "citation_author")]');
for (var i = 0; i < artists.length; i++) {
var cleaned = artists[i].content.replace(/\(.*\)$/, '').trim();
item.creators.push(ZU.cleanAuthor(cleaned, 'artist'));
}
item.attachments.push({
title: 'Snapshot',
document: doc
});
item.date = ZU
.xpath(doc, '//dl[@id="dl-artwork-details"]/dd[@itemprop="dateCreated"]/*/a')
.map(function (date) {
return date.textContent;
})
.join(', ');
item.artworkMedium = ZU.xpathText(doc, '//dl[@id="dl-artwork-details"]/dd[@itemprop="material"]');
item.artworkSize = ZU.xpathText(doc, '//dl[@id="dl-artwork-details"]/dd[@itemprop="size"]');
item.callNumber = ZU.xpathText(doc, '//dl[@id="dl-artwork-details"]/dd[@itemprop="identifier"]');
item.url = ZU.xpathText(doc, '//link[@rel="canonical"]/@href');
item.complete();
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//ul[@id="artworksList"]/li/a');
for (var i = 0; i < rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.artic.edu/artworks/129884/starry-night-and-the-astronauts",
"items": [
{
"itemType": "artwork",
"title": "Starry Night and the Astronauts",
"creators": [
{
"firstName": "Alma",
"lastName": "Thomas",
"creatorType": "artist"
}
],
"date": "1972",
"artworkMedium": "Acrylic on canvas",
"artworkSize": "152.4 × 134.6 cm (60 × 53 in.)",
"callNumber": "1994.36",
"libraryCatalog": "Art Institute of Chicago",
"url": "https://www.artic.edu/artworks/129884/starry-night-and-the-astronauts",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artic.edu/artworks/156538/chicago-stock-exchange-trading-room-reconstruction-at-the-art-institute-of-chicago",
"items": [
{
"itemType": "artwork",
"title": "Chicago Stock Exchange Trading Room: Reconstruction at the Art Institute of Chicago",
"creators": [
{
"lastName": "Architects",
"creatorType": "artist",
"firstName": "Adler & Sullivan"
}
],
"date": "Built 18931894",
"artworkMedium": "Mixed media recreation of room",
"artworkSize": "Room is roughly 5,704 square feet (not including gallery)",
"callNumber": "RX23310/0002",
"libraryCatalog": "Art Institute of Chicago",
"shortTitle": "Chicago Stock Exchange Trading Room",
"url": "https://www.artic.edu/artworks/156538/chicago-stock-exchange-trading-room-reconstruction-at-the-art-institute-of-chicago",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artic.edu/artworks/28560/the-bedroom",
"items": [
{
"itemType": "artwork",
"title": "The Bedroom",
"creators": [
{
"lastName": "Gogh",
"creatorType": "artist",
"firstName": "Vincent van"
}
],
"date": "1889",
"artworkMedium": "Oil on canvas",
"artworkSize": "73.6 × 92.3 cm (29 × 36 5/8 in.)",
"callNumber": "1926.417",
"libraryCatalog": "Art Institute of Chicago",
"url": "https://www.artic.edu/artworks/28560/the-bedroom",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artic.edu/artworks/52273/platform-bench",
"items": [
{
"itemType": "artwork",
"title": "Platform Bench",
"creators": [
{
"firstName": "George",
"lastName": "Nelson",
"creatorType": "artist"
},
{
"lastName": "Inc",
"creatorType": "artist",
"firstName": "Herman Miller"
}
],
"date": "Designed 1946, Made 1946-1967, c. 1946-1967",
"artworkMedium": "Birch",
"artworkSize": "35.5 × 47 × 183.5 cm (14 × 18 1/2 × 72 1/4 in.)",
"callNumber": "1978.141",
"libraryCatalog": "Art Institute of Chicago",
"url": "https://www.artic.edu/artworks/52273/platform-bench",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artic.edu/artworks/7691/gathering-seaweed-at-omori",
"items": [
{
"itemType": "artwork",
"title": "Gathering Seaweed at Omori",
"creators": [
{
"firstName": "Utagawa",
"lastName": "Kuniyoshi",
"creatorType": "artist"
}
],
"artworkMedium": "Ink and red pigment on paper",
"callNumber": "1958.191",
"libraryCatalog": "Art Institute of Chicago",
"url": "https://www.artic.edu/artworks/7691/gathering-seaweed-at-omori",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

438
Artforum.js Normal file
View File

@ -0,0 +1,438 @@
{
"translatorID": "a127f012-4ea4-4d05-a657-24d47f91b016",
"label": "Artforum",
"creator": "czar",
"target": "^https?://(www\\.)?artforum\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-09-02 00:33:38"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2018 czar
http://en.wikipedia.org/wiki/User_talk:Czar
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (/-\d{5,}([?#].*)?$/.test(url)) {
if (doc.querySelector('h3.print-article__issue-title')) {
return "magazineArticle";
}
return "blogPost";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48'); // embedded metadata (EM)
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) { // corrections to EM
item.publicationTitle = "Artforum";
item.language = 'en-US';
var jsonLD = doc.querySelector('script[type="application/ld+json"]');
if (jsonLD) {
jsonLD = JSON.parse(jsonLD.textContent);
item.title = jsonLD.name;
item.date = jsonLD.dateModified || jsonLD.datePublished;
if (!item.creators.length && jsonLD.author) {
item.creators.push(ZU.cleanAuthor(jsonLD.author.name, 'author'));
}
}
var authorMetadata = doc.querySelectorAll('.contrib-link a');
for (let author of authorMetadata) {
item.creators.push(ZU.cleanAuthor(author.text, "author"));
}
if (url.includes('/print/')) {
item.itemType = "magazineArticle";
item.ISSN = "0004-3532";
var issueDate = doc.querySelector('h3.print-article__issue-title');
if (issueDate) {
item.date = issueDate.textContent.trim().replace('PRINT ','');
ZU.doGet(issueDate.querySelector('a').href, function (respText) {
var voliss = respText.match(/Vol\.\s(\d+),\sNo\.\s(\d+)/);
item.volume = voliss[1];
item.issue = voliss[2];
item.complete();
});
} else item.complete();
} else item.complete();
});
translator.getTranslatorObject(function(trans) {
trans.itemType = 'blogPost';
trans.doWeb(doc, url);
});
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
// 1st for search page, 2nd for issue ToC, 3rd/4th/5th for sections, 5th+ for homepage
var rows = doc.querySelectorAll('h1.results-list__h1, .toc-article__title, .news-list h1, .reviews-list h1, .article-list h1, p.hp-singlefeature-author__writer, h3.hp-news__title, h3.hp-twocolumn__title a, h3.hp-artguide__title, p.hp-bloglist__teaser a');
for (let i = 0; i < rows.length; i++) {
let href = attr(rows[i], 'a', 'href');
if (!href) {
let link = rows[i].closest('a');
if (link) href = link.href;
}
let title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
switch (detectWeb(doc, url)) {
case "multiple":
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return;
}
ZU.processDocuments(Object.keys(items), scrape);
});
break;
default:
scrape(doc, url);
break;
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.artforum.com/news/ugochukwu-smooth-nzewi-appointed-curator-of-hood-museum-40747",
"items": [
{
"itemType": "blogPost",
"title": "Ugochukwu-Smooth Nzewi Appointed Curator of Hood Museum",
"creators": [],
"date": "2013-05-06",
"abstractNote": "The Hood Museum of Art at Dartmouth College, Hanover, has appointed Ugochukwu-Smooth Nzewi as its first curator of African Art, reports Artdaily. Born in Nigeria, Nzewi received his PhD in Art History from Emory University. A specialist in modern and contemporary African and African Diaspora arts, he will be responsible in his new role for the documentation, preservation, and research of Hoods African Art collection, which includes some 1,900 objects. He will also engage Dartmouth faculty and students in the development of curricular programming related to the museums African holdings. Nzewi",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/news/ugochukwu-smooth-nzewi-appointed-curator-of-hood-museum-40747",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/diary/kaitlin-phillips-at-the-11th-new-york-art-book-fair-63626",
"items": [
{
"itemType": "blogPost",
"title": "Fine Print",
"creators": [
{
"firstName": "Kaitlin",
"lastName": "Phillips",
"creatorType": "author"
}
],
"date": "2016-09-22",
"abstractNote": "LAST THURSDAY, at the opening night preview of Printed Matters NY Book Fair at MoMA PS1, in the popup white dome in the courtyard, at one of the end-to-end merchandise tables, V. Vale (“Thats the name Im famous under”), founder of RE/Search, complains to a fan that the fair, in its eleventh year, and its host city, have lost their street cred:“I never come to New York. Yeah, I never come to New York. I never come to New York,” says Vale, beaming defiantly.“Well, New York may have jumped the shark.”“I dont know what that means. Jump the shark.”“It means that something has hit its peak, and",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/diary/kaitlin-phillips-at-the-11th-new-york-art-book-fair-63626",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/picks/alex-da-corte-62421",
"items": [
{
"itemType": "blogPost",
"title": "Alex Da Corte",
"creators": [
{
"firstName": "Aria",
"lastName": "Dean",
"creatorType": "author"
}
],
"date": "2016-07-28",
"abstractNote": "As you enter this space, your senses are bombarded by Alex Da Cortes scrambled, saturated landscape. A supersized witchs hat fills the first area, lit by green and red neon from above. This is flanked by a stained-glass window depicting a red rose, referencing Disneys Beauty and the Beast, and a floor-to-ceiling, blown-up image of a weeping bridesmaid. The exhibition is like a dream: Recognizable elements are mashed together, but something is off, and it gradually morphs into a surreal nightmare.The gallery buzzes with sound from three video works—the focal point of the second room—depicting",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/picks/alex-da-corte-62421",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/film/nick-pinkerton-on-gimme-shelter-hollywood-north-66885",
"items": [
{
"itemType": "blogPost",
"title": "Canadian Makin",
"creators": [
{
"firstName": "Nick",
"lastName": "Pinkerton",
"creatorType": "author"
}
],
"date": "2017-02-24",
"abstractNote": "AFTER THE EMERGENCE of alluring Canadian production subsidies in the late 1990s, moviegoers of the aughts became inured to watching downtown Vancouver fill in for AnyCity, USA, in a parade of multiplex productions that managed to extract bland back-lot anonymity from location shooting. But Anthology Film Archives twelve-film series “Gimme Shelter: Hollywood North” pays tribute to a very different, pioneering era of runaway production, part of an ongoing sesquicentennial celebration of our neighbors above to be followed by “1970s Canadian Independents,” beginning at Anthology on March 9.The",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/film/nick-pinkerton-on-gimme-shelter-hollywood-north-66885",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/previews/201701/whitney-biennial-2017-65484",
"items": [
{
"itemType": "magazineArticle",
"title": "Whitney Biennial 2017",
"creators": [
{
"firstName": "Beau",
"lastName": "Rutland",
"creatorType": "author"
}
],
"date": "January 2017",
"ISSN": "0004-3532",
"abstractNote": "Curated by Christopher Y. Lew and Mia LocksFollowing a three-year hiatus to accommodate the museums move downtown, the Whitney Biennial makes its Gansevoort Street debut this March. As the republic falls before our very eyes, one hopes that this divisive survey of American art will react against, and not just reflect, the current state of affairs. This years roster of sixty-three artists and collectives is thankfully diverse in perspectives and refreshingly full of emerging and underrecognized voices&#151;absent are the many elder statesmen often gratuitously included in these affairs. The",
"issue": "5",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/previews/201701/whitney-biennial-2017-65484",
"volume": "55",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/interviews/jamie-stewart-talks-about-xiu-xiu-s-record-forget-and-recent-collaborations-66615",
"items": [
{
"itemType": "blogPost",
"title": "Jamie Stewart",
"creators": [
{
"firstName": "Paige K.",
"lastName": "Bradley",
"creatorType": "author"
}
],
"date": "2017-02-21",
"abstractNote": "Across thirteen albums and a handful of EPs, Xiu Xiu have remained a prickly, relentless force, inspiring loyalty, love, annoyance, and disgust in equal measure. Some people never get over their music, and some you couldnt pay to even approach it. On the occasion of the release of their latest album, FORGET, the bands mainstay Jamie Stewart discusses how he met Vaginal Davis (who performs on its last track), the bands collaborations with Danh Vō, and the concept behind the records title. Polyvinyl will release FORGET on February 24, 2017.HOW I MET VAGINAL DAVIS is actually a long story and",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/interviews/jamie-stewart-talks-about-xiu-xiu-s-record-forget-and-recent-collaborations-66615",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/reviews/201408/dak-art-2014-48214",
"items": [
{
"itemType": "magazineArticle",
"title": "DakArt 2014",
"creators": [
{
"firstName": "Chika",
"lastName": "Okeke-Agulu",
"creatorType": "author"
}
],
"date": "October 2014",
"ISSN": "0004-3532",
"abstractNote": "THE ELEVENTH EDITION of the DakArt Biennial of Contemporary African Art, which took place this past summer, may well have been the most ambitious since the exhibitions inception in 1992. It was the largest and most diverse yet, not only showcasing emerging artists from across Africa but also including the work of many superstars from the established biennial circuit. This roster showed that the global art world must reckon with DakArt, which seems poised to take its place among the most established international art shows. Yet this years iteration also suggested that the biennial is still",
"issue": "2",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/reviews/201408/dak-art-2014-48214",
"volume": "53",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/search?search=1%3A54&sort=date",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/print/previews/current/new-york",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/print/201806",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.artforum.com/news/levy-gorvy-amalia-dayan-salon-94-merge-to-form-upper-east-side-megagallery-86598",
"items": [
{
"itemType": "blogPost",
"title": "New York Dealers Lévy Gorvy, Amalia Dayan, Salon 94, Announce Merger",
"creators": [],
"date": "2021-09-01",
"abstractNote": "Two New York galleries—Lévy Gorvy and Salon 94—and dealer Amalia Dayan have announced that they are joining forces to establish a single consortium, called LGDR, whose flagship will be situated on the citys tony Upper East Side. The news, first reported in the New York Times, is said to have come as a shock to a number of the galleries artists, whose fate is unclear.The new entity, which takes its name from the last initials of its owners—Dominique Lévy and Brett Gorvy, cofounders of Lévy Gorvy; veteran dealer Amalia Dayan; and Jeanne Greenberg Rohatyn, the owner of Salon 94—will occupy digs",
"blogTitle": "Artforum",
"language": "en-US",
"url": "https://www.artforum.com/news/levy-gorvy-amalia-dayan-salon-94-merge-to-form-upper-east-side-megagallery-86598",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.artforum.com/print/202107/david-salle-on-janet-malcolm-86314",
"items": [
{
"itemType": "magazineArticle",
"title": "JANET MALCOLM (19342021)",
"creators": [
{
"firstName": "David",
"lastName": "Salle",
"creatorType": "author"
}
],
"date": "September 2021",
"ISSN": "0004-3532",
"abstractNote": "ABOUT TWENTY-FIVE YEARS AGO Janet Malcolm published a profile of me in the New Yorker that became something of a touchstone of art journalism. It served as the title essay of one of her collections, and has been reprinted several times. Im told its often assigned in classes on art writing, on the assumption that it sheds some light on that murky enterprise.Its uncommon for the subject of a profile to warmly remember the profiler, and my friendship with Janet struck some people as odd. For some, it would be hard, or so they imagined, to get past the discomforts of so much self-exposure, and",
"issue": "1",
"language": "en-US",
"libraryCatalog": "www.artforum.com",
"publicationTitle": "Artforum",
"url": "https://www.artforum.com/print/202107/david-salle-on-janet-malcolm-86314",
"volume": "60",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,311 @@
{
"translatorID": "01322929-5782-4612-81f7-d861fb46d9f2",
"label": "Atlanta Journal-Constitution",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?ajc\\.com",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-07-14 19:41:44"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (doc.querySelector('.c-articleContent')
&& doc.querySelector('script[type="application/ld+json"]')) {
if (url.includes('blog/')) {
return "blogPost";
}
else {
return "newspaperArticle";
}
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('a.gs-title');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
let json = JSON.parse(text(doc, 'script[type="application/ld+json"]'));
let item = new Zotero.Item(
url.includes('blog/')
? 'blogPost'
: 'newspaperArticle'
);
item.title = json.headline;
item.abstractNote = json.description
|| attr(doc, 'meta[name="description"]', 'content');
item.place = extractPlace(item.abstractNote);
let sectionLabel = text(doc, '.section-label');
if (item.itemType == 'blogPost') {
item.blogTitle = `${sectionLabel} (The Atlanta Journal-Constitution)`;
}
else {
item.section = sectionLabel;
item.publicationTitle = 'The Atlanta Journal-Constitution';
item.ISSN = '1539-7459';
}
item.language = attr(doc, 'meta[name="language"]', 'content');
item.libraryCatalog = 'AJC.com';
for (let author of json.author.name.split(', ')) {
item.creators.push(ZU.cleanAuthor(author, 'author'));
}
item.attachments.push({
title: 'Snapshot',
document: doc
});
item.complete();
}
function extractPlace(leadText) {
let placeRe = /^\s*([A-Z\-']{3,})\b/;
if (placeRe.test(leadText)) {
return ZU.capitalizeTitle(leadText.match(placeRe)[1], true);
}
else {
return '';
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.ajc.com/politics/georgia-republicans-center-campaigns-on-false-claims-of-election-fraud/JNRJYNAG6BD5JC5BB2TQG3LYGA/",
"items": [
{
"itemType": "newspaperArticle",
"title": "Georgia Republicans center campaigns on false claims of election fraud",
"creators": [
{
"firstName": "Greg",
"lastName": "Bluestein",
"creatorType": "author"
}
],
"ISSN": "1539-7459",
"abstractNote": "ROME — The organizers at the door handed out soft-pink “Trump Won” signs to each attendee. An out-of-state radio host spouted far-right conspiracies.",
"language": "English",
"libraryCatalog": "AJC.com",
"place": "Rome",
"publicationTitle": "The Atlanta Journal-Constitution",
"section": "Politics",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ajc.com/politics/politics-blog/the-jolt-details-emerge-about-ames-barnett-possible-brian-kemp-primary-foe/MI6WFP3L7VH4NADGFHSXOUS6KM/",
"items": [
{
"itemType": "blogPost",
"title": "The Jolt: Details emerge about Ames Barnett, possible Brian Kemp primary foe",
"creators": [
{
"firstName": "Patricia",
"lastName": "Murphy",
"creatorType": "author"
},
{
"firstName": "Greg",
"lastName": "Bluestein",
"creatorType": "author"
},
{
"firstName": "Tia",
"lastName": "Mitchell",
"creatorType": "author"
}
],
"abstractNote": "Ames Barnett, a wealthy businessman and former small-town mayor, is moving closer to a Republican primary challenge against Gov. Brian Kemp. But his r",
"blogTitle": "Political Insider (The Atlanta Journal-Constitution)",
"language": "English",
"shortTitle": "The Jolt",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ajc.com/neighborhoods/cobb/marietta-officials-homeowner-property-tax-bills-will-go-down-for-third-year-in-a-row/3AIW5PLTXRHLDCWF4Q6HYQVQKQ/",
"items": [
{
"itemType": "newspaperArticle",
"title": "Marietta officials: Homeowner property tax bills will go down for third year in a row",
"creators": [
{
"firstName": "Matt",
"lastName": "Bruce",
"creatorType": "author"
}
],
"ISSN": "1539-7459",
"abstractNote": "Property values have surged during the pandemic, but Marietta officials say homeowners will pay less in taxes.",
"language": "English",
"libraryCatalog": "AJC.com",
"publicationTitle": "The Atlanta Journal-Constitution",
"section": "Cobb County",
"shortTitle": "Marietta officials",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ajc.com/things-to-do/restaurant-refresh/patio-picks-treat-yourself-to-alfresco-elegance/ZF4FZUMJYBB6HJXTS32QCEYGSA/",
"items": [
{
"itemType": "newspaperArticle",
"title": "Atlanta patio picks: Treat yourself to alfresco elegance",
"creators": [
{
"firstName": "Ligaya",
"lastName": "Figueras",
"creatorType": "author"
},
{
"firstName": "Wendell",
"lastName": "Brock",
"creatorType": "author"
}
],
"ISSN": "1539-7459",
"abstractNote": "Check out four of the best patios in metro Atlanta to eat and drink, including the Chastain, Delbar, Banshee and Willow Bar.",
"language": "English",
"libraryCatalog": "AJC.com",
"publicationTitle": "The Atlanta Journal-Constitution",
"section": "Restaurant Refresh",
"shortTitle": "Atlanta patio picks",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ajc.com/life/radiotvtalk-blog/whats-filming-in-georgia-in-july-2021/7UJ6NZIF7NA6LJFG7QPHE4HFDM/",
"items": [
{
"itemType": "blogPost",
"title": "Whats filming in Georgia in July 2021?",
"creators": [
{
"firstName": "Rodney",
"lastName": "Ho",
"creatorType": "author"
}
],
"abstractNote": "\"Black Panther: Wakanda Forever\" began production in late June 2021 at Trilith Studios in Fayetteville.",
"blogTitle": "Radio & TV Talk Blog (The Atlanta Journal-Constitution)",
"language": "English",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.ajc.com/search/?q=labor",
"items": "multiple"
}
]
/** END TEST CASES **/

File diff suppressed because it is too large Load Diff

View File

@ -2,21 +2,21 @@
"translatorID": "5ed5ab01-899f-4a3b-a74c-290fb2a1c9a4",
"label": "AustLII and NZLII",
"creator": "Justin Warren, Philipp Zumstein",
"target": "^https?://www\\d?\\.(austlii\\.edu\\.au|nzlii\\.org)",
"target": "^https?://(www\\d?|classic)\\.(austlii\\.edu\\.au|nzlii\\.org)",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2018-03-02 09:46:09"
"lastUpdated": "2024-11-21 18:54:11"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2018 Justin Warren, Philipp Zumstein
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
@ -35,15 +35,9 @@
***** END LICENSE BLOCK *****
*/
// attr()/text() v2
function attr(docOrElem,selector,attr,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.getAttribute(attr):null;}function text(docOrElem,selector,index){var elem=index?docOrElem.querySelectorAll(selector).item(index):docOrElem.querySelector(selector);return elem?elem.textContent:null;}
function detectWeb(doc, url) {
var classes = attr(doc, 'body', 'class');
// Z.debug(classes);
if (classes.includes('case')) {
return "case";
}
@ -59,9 +53,13 @@ function detectWeb(doc, url) {
if (url.includes('austlii.edu.au/cgi-bin/sinodisp/au/cases/') && url.includes('.html')) {
return "case";
}
if (url.includes('classic.austlii.edu.au') && url.includes('.html')) {
return "case";
}
if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
@ -69,7 +67,7 @@ function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('#page-main ul>li>a');
for (let i=0; i<rows.length; i++) {
for (let i = 0; i < rows.length; i++) {
let href = rows[i].href;
let title = ZU.trimInternal(rows[i].textContent);
if (!href || !title) continue;
@ -82,49 +80,111 @@ function getSearchResults(doc, checkOnly) {
}
function doWeb(doc, url) {
var type = detectWeb(doc, url);
if (type == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
});
} else {
async function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (!items) return;
for (let url of Object.keys(items)) {
scrape(await requestDocument(url), url);
}
}
else if (new URL(url).hostname === 'classic.austlii.edu.au') {
let urlObj = new URL(url);
urlObj.hostname = 'www.austlii.edu.au';
url = urlObj.toString();
scrape(await requestDocument(url), url);
}
else {
scrape(doc, url);
}
}
/*
* Adjust some jurisdiction abbreviations
*/
var jurisdictionAbbrev = {
"Commonwealth": "Cth",
"CTH": "Cth",
"Australian Capital Territory": "ACT",
"New South Wales": "NSW",
"Northern Territory": "NT",
"Queensland": "Qld",
"QLD": "Qld",
"South Australia": "SA",
"Tasmania": "Tas",
"TAS": "Tas",
"Victoria": "Vic",
"VIC": "Vic",
"Western Australia": "WA"
};
/*
* ZU.capitalizeTitle doesn't cope with Act Names (With Parenthetical Names) Acts
* so we give it a bit of help.
*/
function capitalizeWithPunctuation(string) {
const actNameDelimRegex = /( \(|\) )/;
var words = string.split(actNameDelimRegex);
var newString = "";
var lastWordIndex = words.length - 1;
for (var i = 0; i <= lastWordIndex; i++) {
if (actNameDelimRegex.test(words[i])) {
newString += words[i];
}
else {
newString += ZU.capitalizeTitle(words[i].toLowerCase(), true);
}
}
return newString;
}
/*
* AustLII includes the date on the end of all Acts
*/
function parseActName(nameOfAct) {
// Split at the last space before the year
const parsed = nameOfAct.split(/\s(\d{4})/);
// Zotero.debug(parsed);
let actName = parsed[0], actYear = parsed[1];
actName = capitalizeWithPunctuation(actName);
return { actName, actYear };
}
function scrape(doc, url) {
var type = detectWeb(doc, url);
var newItem = new Zotero.Item(type);
var jurisdiction = text(doc, 'li.ribbon-jurisdiction>a>span');
if (jurisdiction) {
newItem.extra = "jurisdiction: " + jurisdiction;
var fullJurisdiction = text(doc, 'li.ribbon-jurisdiction > a > span');
var jurisdiction = jurisdictionAbbrev[fullJurisdiction] || fullJurisdiction;
if (jurisdiction && ZU.fieldIsValidForType('code', type)) {
newItem.code = jurisdiction;
}
var citation = text(doc, 'li.ribbon-citation>a>span');
var voliss;
var m;
if (text(doc, '#ribbon')) {
if (type == "case") {
var voliss = text(doc, 'head>title');
voliss = text(doc, 'head>title');
// e.g. C & M [2006] FamCA 212 (20 January 2006)
newItem.caseName = voliss.replace(/\s?\[.*$/, '');
newItem.title = newItem.caseName;
var lastParenthesis = voliss.match(/\(([^\)]*)\)$/);
var lastParenthesis = voliss.match(/\(([^)]*)\)$/);
if (lastParenthesis) {
newItem.dateDecided = ZU.strToISO(lastParenthesis[1]);
} else {
}
else {
newItem.dateDecided = text(doc, 'li.ribbon-year>a>span');
}
newItem.court = text(doc, 'li.ribbon-database>a>span');
var courtAbbrevInURL = url.match(/\/cases\/[^/]+\/([^/]+)\//);
if (courtAbbrevInURL) {
newItem.court = decodeURIComponent(courtAbbrevInURL[1]);
}
else {
// Full court name
newItem.court = text(doc, 'li.ribbon-database > a > span');
}
if (citation) {
var lastNumber = citation.match(/(\d+)$/);
if (lastNumber) {
@ -133,49 +193,56 @@ function scrape(doc, url) {
}
}
if (type == "statute") {
// title
newItem.nameOfAct = citation.trim();
// All AustLII Act titles end in the year the Act was passed
const actInfo = parseActName(citation);
newItem.nameOfAct = actInfo.actName;
newItem.dateEnacted = actInfo.actYear;
// section
newItem.section = text(doc, 'li.ribbon-subject>a>span');
if (newItem.section) newItem.section = newItem.section.replace(/^SECT /, '');
}
if (type == "journalArticle") {
var title = text(doc, 'title');
var m = title.match(/(.*) --- "([^"]*)"/);
m = title.match(/(.*) --- "([^"]*)"/);
if (m) {
newItem.title = m[2];
var authors = m[1].split(';');
for (let i=0; i<authors.length; i++) {
for (let i = 0; i < authors.length; i++) {
newItem.creators.push(ZU.cleanAuthor(authors[i], 'author', authors[i].includes(',')));
}
} else {
}
else {
newItem.title = title;
}
newItem.publicationTitle = text(doc, 'li.ribbon-database>a>span');
newItem.date = text(doc, 'li.ribbon-year>a>span');
}
} else {
var voliss = text(doc, 'head>title');
}
else {
voliss = text(doc, 'head>title');
// e.g. C & M [2006] FamCA 212 (20 January 2006)
var m = voliss.match(/^([^[]*)\[(\d+)\](.*)\(([^\)]*)\)$/);
m = voliss.match(/^([^[]*)\[(\d+)\](.*)\(([^)]*)\)$/);
if (m) {
newItem.title = m[1];
newItem.dateDecided = ZU.strToISO(m[4]);
var courtNumber = m[3].trim().split(' ');
if (courtNumber.length>=2) {
if (courtNumber.length >= 2) {
newItem.court = courtNumber[0];
newItem.docketNumber = courtNumber[1].replace(/[^\w]*$/, '');
}
} else {
}
else {
newItem.title = voliss;
}
}
newItem.url = url;
newItem.url = url
.replace(/^http:\/\//, 'https://')
.replace(/^(https:\/\/www)\d/, '$1');
newItem.attachments = [{
document: doc,
title: "Snapshot",
mimeType:"text/html"
mimeType: "text/html"
}];
newItem.complete();
}
@ -184,17 +251,16 @@ function scrape(doc, url) {
var testCases = [
{
"type": "web",
"url": "http://www7.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FamCA/2006/212.html",
"url": "http://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FamCA/2006/212.html",
"items": [
{
"itemType": "case",
"caseName": "C & M",
"creators": [],
"dateDecided": "2006-01-20",
"court": "Family Court of Australia",
"court": "FamCA",
"docketNumber": "212",
"extra": "jurisdiction: Commonwealth",
"url": "http://www7.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FamCA/2006/212.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FamCA/2006/212.html",
"attachments": [
{
"title": "Snapshot",
@ -209,17 +275,16 @@ var testCases = [
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FCA/2010/1.html",
"url": "http://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FCA/2010/1.html",
"items": [
{
"itemType": "case",
"caseName": "Yeo, in the matter of AES Services (Aust) Pty Ltd (ACN 111 306 543) (Administrators Appointed)",
"creators": [],
"dateDecided": "2010-01-05",
"court": "Federal Court of Australia",
"court": "FCA",
"docketNumber": "1",
"extra": "jurisdiction: Commonwealth",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FCA/2010/1.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FCA/2010/1.html",
"attachments": [
{
"title": "Snapshot",
@ -243,7 +308,7 @@ var testCases = [
"dateDecided": "2008-02-08",
"court": "NZSC",
"docketNumber": "1",
"url": "http://www.nzlii.org/nz/cases/NZSC/2008/1.html",
"url": "https://www.nzlii.org/nz/cases/NZSC/2008/1.html",
"attachments": [
{
"title": "Snapshot",
@ -258,22 +323,21 @@ var testCases = [
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/viewtoc/au/cases/act/ACTSC/2010/",
"url": "http://www.austlii.edu.au/cgi-bin/viewtoc/au/cases/act/ACTSC/2010/",
"items": "multiple"
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/134.html",
"url": "http://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/134.html",
"items": [
{
"itemType": "case",
"caseName": "'NM' and Department of Human Services (Freedom of information)",
"creators": [],
"dateDecided": "2017-12-08",
"court": "Australian Information Commissioner",
"court": "AICmr",
"docketNumber": "134",
"extra": "jurisdiction: Commonwealth",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/134.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/134.html",
"attachments": [
{
"title": "Snapshot",
@ -288,15 +352,16 @@ var testCases = [
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/legis/cth/consol_act/foia1982222/s24ab.html",
"url": "http://www.austlii.edu.au/cgi-bin/viewdoc/au/legis/cth/consol_act/foia1982222/s24ab.html",
"items": [
{
"itemType": "statute",
"nameOfAct": "Freedom of Information Act 1982",
"nameOfAct": "Freedom of Information Act",
"creators": [],
"extra": "jurisdiction: Commonwealth",
"dateEnacted": "1982",
"code": "Cth",
"section": "24AB",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdoc/au/legis/cth/consol_act/foia1982222/s24ab.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/legis/cth/consol_act/foia1982222/s24ab.html",
"attachments": [
{
"title": "Snapshot",
@ -311,14 +376,15 @@ var testCases = [
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/foia1982222/",
"url": "http://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/foia1982222/",
"items": [
{
"itemType": "statute",
"nameOfAct": "Freedom of Information Act 1982",
"nameOfAct": "Freedom of Information Act",
"creators": [],
"extra": "jurisdiction: CTH",
"url": "http://www8.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/foia1982222/",
"dateEnacted": "1982",
"code": "Cth",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/foia1982222/",
"attachments": [
{
"title": "Snapshot",
@ -333,7 +399,53 @@ var testCases = [
},
{
"type": "web",
"url": "http://www9.austlii.edu.au/cgi-bin/viewdoc/au/journals/AdminRw//2010/9.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/antsasta1999402/",
"items": [
{
"itemType": "statute",
"nameOfAct": "A New Tax System (Goods and Services Tax) Act",
"creators": [],
"dateEnacted": "1999",
"code": "Cth",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/antsasta1999402/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/caca2010265/",
"items": [
{
"itemType": "statute",
"nameOfAct": "Competition and Consumer Act",
"creators": [],
"dateEnacted": "2010",
"code": "Cth",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/cth/consol_act/caca2010265/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://www.austlii.edu.au/cgi-bin/viewdoc/au/journals/AdminRw//2010/9.html",
"items": [
{
"itemType": "journalArticle",
@ -353,7 +465,7 @@ var testCases = [
"date": "2010",
"libraryCatalog": "AustLII and NZLII",
"publicationTitle": "Administrative Review Council - Admin Review",
"url": "http://www9.austlii.edu.au/cgi-bin/viewdoc/au/journals/AdminRw//2010/9.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/journals/AdminRw//2010/9.html",
"attachments": [
{
"title": "Snapshot",
@ -368,12 +480,12 @@ var testCases = [
},
{
"type": "web",
"url": "http://www7.austlii.edu.au/cgi-bin/sinosrch.cgi?mask_path=;method=auto;query=adam%20smith;view=relevance&mask_path=au/cases/act/ACTCA",
"url": "http://www.austlii.edu.au/cgi-bin/sinosrch.cgi?mask_path=;method=auto;query=adam%20smith;view=relevance&mask_path=au/cases/act/ACTCA",
"items": "multiple"
},
{
"type": "web",
"url": "http://www8.austlii.edu.au/cgi-bin/sinodisp/au/cases/cth/AICmr/2017/20.html",
"url": "http://www6.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/20.html",
"items": [
{
"itemType": "case",
@ -382,7 +494,100 @@ var testCases = [
"dateDecided": "2017-03-10",
"court": "AICmr",
"docketNumber": "20",
"url": "http://www8.austlii.edu.au/cgi-bin/sinodisp/au/cases/cth/AICmr/2017/20.html",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/AICmr/2017/20.html",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/qld/consol_act/pla1974179/",
"items": [
{
"itemType": "statute",
"nameOfAct": "Property Law Act",
"creators": [],
"dateEnacted": "1974",
"code": "Qld",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/qld/consol_act/pla1974179/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/vic/consol_act/ca195882/",
"items": [
{
"itemType": "statute",
"nameOfAct": "Crimes Act",
"creators": [],
"dateEnacted": "1958",
"code": "Vic",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/vic/consol_act/ca195882/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/nsw/consol_act/leara2002451/",
"items": [
{
"itemType": "statute",
"nameOfAct": "Law Enforcement (Powers and Responsibilities) Act",
"creators": [],
"dateEnacted": "2002",
"code": "NSW",
"url": "https://www.austlii.edu.au/cgi-bin/viewdb/au/legis/nsw/consol_act/leara2002451/",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www8.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FedCFamC1A/2024/214.html",
"items": [
{
"itemType": "case",
"caseName": "Dimitrova & Carman",
"creators": [],
"dateDecided": "2024-11-15",
"court": "FedCFamC1A",
"docketNumber": "214",
"url": "https://www.austlii.edu.au/cgi-bin/viewdoc/au/cases/cth/FedCFamC1A/2024/214.html",
"attachments": [
{
"title": "Snapshot",

File diff suppressed because one or more lines are too long

136
BAILII.js
View File

@ -9,113 +9,128 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2014-04-03 16:36:35"
"lastUpdated": "2021-09-16 20:57:17"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Bill McKinney
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
var liiRegexp = /^https?:\/\/www\.bailii\.org(?:\/cgi-bin\/markup\.cgi\?doc=)?\/\w+\/cases\/.+\.html/;
function detectWeb(doc, url) {
var liiRegexp= /^https?:\/\/www\.bailii\.org(?:\/cgi\-bin\/markup\.cgi\?doc\=)?\/\w+\/cases\/.+\.html/
if (liiRegexp.test(url)) {
return "case";
} else {
}
else {
var aTags = doc.getElementsByTagName("a");
for (var i=0; i<aTags.length; i++) {
for (var i = 0; i < aTags.length; i++) {
if (liiRegexp.test(aTags[i].href)) {
return "multiple";
}
}
}
return false;
}
function scrape(doc, url) {
var newItem = new Zotero.Item("case");
newItem.title = doc.title;
newItem.url = doc.location.href;
var titleRegexp = /^(.+)\s+\[(\d+)\]\s+(.+)\s+\((\d+)\s+(\w+)\s+(\d+)\)/
var titleMatch = titleRegexp .exec(doc.title);
if (titleMatch ) {
var titleRegexp = /^(.+)\s+\[(\d+)\]\s+(.+)\s+\((\d+)\s+(\w+)\s+(\d+)\)/;
var titleMatch = titleRegexp.exec(doc.title);
if (titleMatch) {
newItem.caseName = titleMatch[1] + " [" + titleMatch[2] + "] " + titleMatch[3];
newItem.dateDecided = titleMatch[4] + " " + titleMatch[5] + " " + titleMatch[6];
} else {
}
else {
newItem.caseName = doc.title;
newItem.dateDecided = "not found";
}
var courtRegexp = /cases\/([^\/]+)\/([^\/]+)\//
var courtRegexp = /cases\/([^/]+)\/([^/]+)\//;
var courtMatch = courtRegexp.exec(doc.location.href);
if (courtMatch) {
var divRegexp = /\w+/
var divRegexp = /\w+/;
var divMatch = divRegexp.exec(courtMatch[2]);
if (divMatch) {
newItem.court = courtMatch[1] + " (" + courtMatch[2] + ")";
} else {
}
else {
newItem.court = courtMatch[1];
}
} else {
}
else {
newItem.court = "not found";
}
// judge
var panel = doc.getElementsByTagName("PANEL");
if (panel.length > 0) {
var tmp = panel[0].innerHTML;
newItem.creators.push({lastName:tmp, creatorType:"judge", fieldMode:true});
let name = panel[0].innerHTML;
newItem.creators.push({ lastName: name, creatorType: "author", fieldMode: 1 });
}
// citation
var cite = doc.getElementsByTagName("CITATION");
if (cite.length > 0) {
var tmpc = cite[0].childNodes[0].innerHTML;
newItem.notes.push({note:tmpc});
let note = cite[0].childNodes[0].innerHTML;
newItem.notes.push({ note });
}
newItem.attachments = [{url: url, title: "BAILII Snapshot", mimeType: "text/html"}];
newItem.attachments = [{ url: url, title: "Snapshot", mimeType: "text/html" }];
newItem.complete();
}
function doWeb(doc, url) {
var liiRegexp= /http:\/\/www\.bailii\.org(?:\/cgi\-bin\/markup\.cgi\?doc\=)?\/\w+\/cases\/.+\.html/
if (liiRegexp.test(url)) {
scrape(doc);
} else {
}
else {
var items = Zotero.Utilities.getItemArray(doc, doc, liiRegexp);
var urls = new Array();
Zotero.selectItems(items, function (items) {
if (!items) {
return true;
}
for (var i in items) {
urls.push(i);
}
Zotero.Utilities.processDocuments(urls, scrape, function () {
Zotero.done();
});
Zotero.wait();
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://www.bailii.org/cgi-bin/markup.cgi?doc=/eu/cases/EUECJ/2011/C40308.html&query=copyright&method=boolean",
"url": "https://www.bailii.org/cgi-bin/markup.cgi?doc=/eu/cases/EUECJ/2011/C40308.html&query=copyright&method=boolean",
"items": [
{
"itemType": "case",
"caseName": "Football Association Premier League & Ors (Freedom to provide services) [2011] EUECJ C-403/08",
"creators": [],
"notes": [],
"tags": [],
"seeAlso": [],
"dateDecided": "04 October 2011",
"court": "EUECJ (2011)",
"url": "https://www.bailii.org/cgi-bin/markup.cgi?doc=/eu/cases/EUECJ/2011/C40308.html&query=copyright&method=boolean",
"attachments": [
{
"title": "BAILII Snapshot",
"title": "Snapshot",
"mimeType": "text/html"
}
],
"title": "Football Association Premier League & Ors (Freedom to provide services) [2011] EUECJ C-403/08",
"url": "http://www.bailii.org/cgi-bin/markup.cgi?doc=/eu/cases/EUECJ/2011/C40308.html&query=copyright&method=boolean",
"caseName": "Football Association Premier League & Ors (Freedom to provide services) [2011] EUECJ C-403/08",
"dateDecided": "04 October 2011",
"court": "EUECJ (2011)",
"libraryCatalog": "BAILII",
"accessDate": "CURRENT_TIMESTAMP"
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
@ -123,6 +138,39 @@ var testCases = [
"type": "web",
"url": "http://www.bailii.org/eu/cases/EUECJ/2007/",
"items": "multiple"
},
{
"type": "web",
"url": "https://www.bailii.org/ew/cases/EWHC/Comm/2020/170.html",
"items": [
{
"itemType": "case",
"caseName": "Forum Services International Ltd & Anor v OOS International BV [2020] EWHC 170 (Comm)",
"creators": [
{
"lastName": "MR JUSTICE ROBIN KNOWLES CBE",
"creatorType": "author",
"fieldMode": true
}
],
"dateDecided": "31 January 2020",
"court": "EWHC (Comm)",
"url": "https://www.bailii.org/ew/cases/EWHC/Comm/2020/170.html",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [
{
"note": "Neutral Citation Number: [2020] EWHC 170 (Comm)"
}
],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View File

@ -8,8 +8,8 @@
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsbv",
"lastUpdated": "2014-04-04 10:08:22"
"browserSupport": "gcsibv",
"lastUpdated": "2021-12-28 04:44:52"
}
function detectWeb(doc, url) {
@ -33,21 +33,24 @@ function doWeb(doc, url) {
titles.iterateNext();
while (title=titles.iterateNext())
items[codes.iterateNext().nodeValue]=title.nodeValue;
items=Zotero.selectItems(items);
var string="http://ask.bibsys.no/ask/action/result?control=ctr_top";
for (var codes in items)
string+="&valg="+codes;
string+="&control=ctr_bottom&eksportFormat=refmanager&eksportEpostAdresse=&eksportEpostFormat=fortekst&cmd=sendtil";
Zotero.Utilities.HTTP.doGet(string, function(text) {
var trans=Zotero.loadTranslator("import");
trans.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
trans.setString(text);
trans.setHandler("itemDone", function(obj, item) {
item.title = item.title.replace(/\s\s+/, " ").replace(/\s:/, ":");
item.complete();
});
trans.translate();
Zotero.selectItems(items, function (items) {
if (!items) return;
var string="http://ask.bibsys.no/ask/action/result?control=ctr_top";
for (var codes in items)
string+="&valg="+codes;
string+="&control=ctr_bottom&eksportFormat=refmanager&eksportEpostAdresse=&eksportEpostFormat=fortekst&cmd=sendtil";
Zotero.Utilities.HTTP.doGet(string, function(text) {
var trans=Zotero.loadTranslator("import");
trans.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
trans.setString(text);
trans.setHandler("itemDone", function(obj, item) {
item.title = item.title.replace(/\s\s+/, " ").replace(/\s:/, ":");
item.complete();
});
trans.translate();
});
});
return;
}
var singlereg=new RegExp("http://ask\.bibsys\.no/ask/action/show");
if (singlereg.test(url)) {
@ -106,4 +109,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

229
BOE.js Normal file
View File

@ -0,0 +1,229 @@
{
"translatorID": "3f1b68b1-8ee7-4ab7-a514-185d72b2f80d",
"label": "BOE",
"creator": "Félix Brezo (@febrezo)",
"target": "^https?://([a-z]+\\.)?boe\\.es/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-07-26 17:07:40"
}
/*
BOE Translator
Copyright (C) 2020-2021 Félix Brezo, felixbrezo@disroot.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the Affero GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function detectWeb(doc, url) {
if (url.includes("diario_boe") || url.includes("www.boe.es/eli") || url.includes("/doc.php")) {
return "statute";
}
return false;
}
function doWeb(doc, url) {
var resourceType = detectWeb(doc, url);
var newItem = new Zotero.Item(resourceType);
var metadataUri;
if (!url.includes("/xml")) {
var index = 0;
while (true) {
index++;
metadataUri = ZU.xpathText(doc, "(//meta[@property='http://data.europa.eu/eli/ontology#is_embodied_by'])[" + index + "]/@resource");
if (!metadataUri || metadataUri.includes("/xml")) {
break;
}
}
}
else {
metadataUri = url;
}
Zotero.Utilities.HTTP.doGet(metadataUri, function (resText) {
// Clean and parse metadata web
resText = resText.replace(/<!DOCTYPE[^>]*>/, "").replace(/<\?xml[^>]*\?>/, "");
resText = Zotero.Utilities.trim(resText);
var parser = new DOMParser();
var metadataDoc = parser.parseFromString(resText, "text/xml");
// Start scraping
var tmpAuthor = ZU.xpathText(metadataDoc, "//departamento");
if (tmpAuthor) {
newItem.creators.push({ lastName: tmpAuthor, creatorType: "author", fieldMode: 1 });
}
var tmpDate = ZU.xpathText(metadataDoc, "//fecha_publicacion");
newItem.dateEnacted = ZU.strToISO(tmpDate.substring(0, 4) + "/" + tmpDate.substring(4, 6) + "/" + tmpDate.substring(6, 8));
newItem.nameOfAct = ZU.xpathText(metadataDoc, "//titulo").replace(/\.$/, ""); // Remove trailing dot
newItem.section = ZU.xpathText(metadataDoc, "//seccion");
newItem.pages = ZU.xpathText(metadataDoc, "//pagina_inicial") + "-" + ZU.xpathText(metadataDoc, "//pagina_final");
newItem.session = ZU.xpathText(metadataDoc, "//diario") + " núm. " + ZU.xpathText(metadataDoc, "//diario_numero");
newItem.codeNumber = ZU.xpathText(metadataDoc, "//identificador");
newItem.publicLawNumber = ZU.xpathText(metadataDoc, "//rango") + " " + ZU.xpathText(metadataDoc, "//numero_oficial");
newItem.url = ZU.xpathText(metadataDoc, "//url_eli");
// Adding the attachment
newItem.attachments.push({
title: "Snapshot",
mimeType: "text/html",
url: url
});
newItem.complete();
});
}/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.boe.es/eli/es/rd/2020/06/30/614",
"items": [
{
"itemType": "statute",
"nameOfAct": "Real Decreto 614/2020, de 30 de junio, por el que se establece una cualificación profesional de la familia profesional Comercio y Marketing, que se incluye en el Catálogo Nacional de Cualificaciones Profesionales",
"creators": [
{
"lastName": "Ministerio de Educación y Formación Profesional",
"creatorType": "author",
"fieldMode": 1
}
],
"dateEnacted": "2020-07-20",
"codeNumber": "BOE-A-2020-8150",
"pages": "53856-53876",
"publicLawNumber": "Real Decreto 614/2020",
"section": "1",
"session": "Boletín Oficial del Estado núm. 197",
"url": "https://www.boe.es/eli/es/rd/2020/06/30/614",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.boe.es/eli/es/rd/2020/06/30/614/dof/spa/xml",
"items": [
{
"itemType": "statute",
"nameOfAct": "Real Decreto 614/2020, de 30 de junio, por el que se establece una cualificación profesional de la familia profesional Comercio y Marketing, que se incluye en el Catálogo Nacional de Cualificaciones Profesionales",
"creators": [
{
"lastName": "Ministerio de Educación y Formación Profesional",
"creatorType": "author",
"fieldMode": 1
}
],
"dateEnacted": "2020-07-20",
"codeNumber": "BOE-A-2020-8150",
"pages": "53856-53876",
"publicLawNumber": "Real Decreto 614/2020",
"section": "1",
"session": "Boletín Oficial del Estado núm. 197",
"url": "https://www.boe.es/eli/es/rd/2020/06/30/614",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.boe.es/diario_boe/xml.php?id=BOE-A-1978-31229",
"items": [
{
"itemType": "statute",
"nameOfAct": "Constitución Española",
"creators": [
{
"lastName": "Cortes Generales",
"creatorType": "author",
"fieldMode": 1
}
],
"dateEnacted": "1978-12-29",
"codeNumber": "BOE-A-1978-31229",
"pages": "29313-29424",
"publicLawNumber": "Constitución",
"section": "1",
"session": "Boletín Oficial del Estado núm. 311",
"url": "https://www.boe.es/eli/es/c/1978/12/27/(1)",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.boe.es/buscar/doc.php?id=BOE-A-1978-31229",
"items": [
{
"itemType": "statute",
"nameOfAct": "Constitución Española",
"creators": [
{
"lastName": "Cortes Generales",
"creatorType": "author",
"fieldMode": 1
}
],
"dateEnacted": "1978-12-29",
"codeNumber": "BOE-A-1978-31229",
"pages": "29313-29424",
"publicLawNumber": "Constitución",
"section": "1",
"session": "Boletín Oficial del Estado núm. 311",
"url": "https://www.boe.es/eli/es/c/1978/12/27/(1)",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2019-12-24 12:46:21"
"lastUpdated": "2021-06-16 17:43:54"
}
/*
@ -88,9 +88,12 @@ function doWeb(doc, url) {
function scrape(doc, _url) {
var dataUrl = attr(doc, 'i.reqdata', 'url');
var diversion = attr(doc, 'i.reqdata', 'diversion');
var sign = attr(doc, 'a.sc_q', 'data-sign');
var risUrl = "http://xueshu.baidu.com/u/citation?&url=" + encodeURIComponent(dataUrl) + "&sign=" + sign + "&diversion=" + diversion + "&t=ris";
let paperId = undefined;
const paperIdMatches = _url.match(/paperid=([a-z0-9]*)/i);
if (paperIdMatches[1]) {
paperId = paperIdMatches[1];
}
const risUrl = `https://xueshu.baidu.com/u/citation?type=ris&paperid=${paperId}`;
var title = doc.title.replace('_百度学术', '');
var tags = [];
@ -99,7 +102,6 @@ function scrape(doc, _url) {
// Z.debug({ ris });
// delete parenthesis in pages information, e.g. SP - 5-7(3)
ris = ris.replace(/(SP\s+-\s\d+-\d+)\(\d+\)$/m, "$1");
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(ris);
@ -151,19 +153,20 @@ function scrape(doc, _url) {
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://xueshu.baidu.com/usercenter/paper/show?paperid=b3ab239032d44d951d8eee26d7bc44bf&site=xueshu_se",
"url": "https://xueshu.baidu.com/usercenter/paper/show?paperid=b3ab239032d44d951d8eee26d7bc44bf&site=xueshu_se",
"items": [
{
"itemType": "journalArticle",
"title": "Zotero: Information management software 2.0",
"title": "Zotero: information management software 2.0",
"creators": [
{
"lastName": "Fernandez",
"firstName": "Peter",
"firstName": "P.",
"creatorType": "author"
}
],
@ -175,11 +178,12 @@ var testCases = [
"pages": "5-7",
"publicationTitle": "Library Hi Tech News",
"shortTitle": "Zotero",
"url": "http://www.emeraldinsight.com/doi/full/10.1108/07419051111154758",
"url": "http://www.emeraldinsight.com/doi/pdfplus/10.1108/07419051111154758",
"volume": "28",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [
@ -209,7 +213,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://xueshu.baidu.com/s?wd=paperuri%3A%2829fcf50a863692823c3f336a9ee1efea%29&filter=sc_long_sign&sc_ks_para=q%3DComparativo%20dos%20softwares%20de%20gerenciamento%20de%20refer%C3%AAncias%20bibliogr%C3%A1ficas%3A%20Mendeley%2C%20EndNote%20e%20Zotero&sc_us=1497086148200551335&tn=SE_baiduxueshu_c1gjeupa&ie=utf-8",
"url": "https://xueshu.baidu.com/usercenter/paper/show?paperid=29fcf50a863692823c3f336a9ee1efea&site=xueshu_se",
"items": [
{
"itemType": "journalArticle",
@ -217,30 +221,44 @@ var testCases = [
"creators": [
{
"lastName": "Yamakawa",
"firstName": "Eduardo Kazumi",
"firstName": "E. K.",
"creatorType": "author"
},
{
"lastName": "Kubota",
"firstName": "Flávio Issao",
"firstName": "F. I.",
"creatorType": "author"
},
{
"lastName": "Beuren",
"firstName": "Fernanda Hansch",
"firstName": "F. H.",
"creatorType": "author"
},
{
"lastName": "Scalvenzi",
"firstName": "L.",
"creatorType": "author"
},
{
"lastName": "Miguel",
"firstName": "Pac",
"creatorType": "author"
}
],
"date": "2014",
"DOI": "10.1590/0103-37862014000200006",
"abstractNote": "A elaboração de uma revisão bibliográfica confiável, a partir de trabalhos relevantes publicados anteriormente, é fundamental para evidenciar a originalidade e a contribuição científica dos trabalhos de pesquisa. Devido à grande quantidade de bases de dados e de publicações disponíveis, torna-se necessário utilizar ferramentas que auxiliem na gestão das referências bibliográficas de uma maneira fácil e padronizada. O objetivo deste artigo é examinar três de gerenciamento bibliográfico utilizados com frequência por pesquisadores acadêmicos, são eles: , e . Nesse sentido, buscou-se, em primeiro lugar, evidenciar seus principais benefícios e as possíveis dificuldades de utilização. Em segundo lugar, procurou-se comparar suas principais características por meio de uma pesquisa teórico-conceitual baseada em literatura especializada, o que permitiu utilizá-los e analisá-los de maneira crítica. Assim sendo, evidenciou-se as principais particularidades de cada e foi elaborado um quadro comparativo entre os mesmos. Considerando as características analisadas nos três , concluiu-se que todos, ao mesmo tempo em que facilitam o trabalho dos pesquisadores, possuem ferramentas que facilitam as buscas, a organização e a análise dos artigos.",
"issue": "2",
"libraryCatalog": "Baidu Scholar",
"publicationTitle": "Transinformação",
"pages": "167-176",
"publicationTitle": "Transinformao",
"shortTitle": "Comparativo dos softwares de gerenciamento de referências bibliográficas",
"url": "http://www.scielo.br/scielo.php?script=sci_arttext&amp;pid=S0103-37862014000200167&amp;lng=pt&amp;nrm=is",
"volume": "26",
"attachments": [
{
"title": "Snapshot"
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
@ -251,7 +269,7 @@ var testCases = [
},
{
"type": "web",
"url": "http://xueshu.baidu.com/s?wd=zotero&rsv_bp=0&tn=SE_baiduxueshu_c1gjeupa&rsv_spt=3&ie=utf-8&f=8&rsv_sug2=0&sc_f_para=sc_tasktype%3D%7BfirstSimpleSearch%7D",
"url": "https://xueshu.baidu.com/s?wd=zotero&rsv_bp=0&tn=SE_baiduxueshu_c1gjeupa&rsv_spt=3&ie=utf-8&f=8&rsv_sug2=0&sc_f_para=sc_tasktype%3D%7BfirstSimpleSearch%7D",
"items": "multiple"
}
]

View File

@ -2,14 +2,14 @@
"translatorID": "7f74d823-d2ba-481c-b717-8b12c90ed874",
"label": "Bangkok Post",
"creator": "Matt Mayer",
"target": "^https://www.bangkokpost.com/[a-z0-9-]+/([a-z0-9-]+/)?[0-9]+",
"target": "^https://www\\.bangkokpost\\.com/[a-z0-9-]+/([a-z0-9-]+/)?[0-9]+",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2020-09-08 07:45:28"
"lastUpdated": "2024-06-18 20:46:45"
}
/*
@ -41,13 +41,7 @@ function detectWeb(_doc, _url) {
function doWeb(doc, url) {
scrape(doc, url);
}
function getMetaTag(doc, attr, value, contentattr) {
const tag = Array.from(doc.getElementsByTagName("meta")).filter(m => m.attributes[attr] && m.attributes[attr].value == value)[0];
if (tag && tag.attributes[contentattr]) {
return tag.attributes[contentattr].value;
}
return null;
}
function scrape(doc, _url) {
const translator = Zotero.loadTranslator('web');
// Embedded Metadata
@ -57,12 +51,15 @@ function scrape(doc, _url) {
translator.setHandler('itemDone', function (obj, item) {
// Add data for fields that are not covered by Embedded Metadata
// Author name is stored as firstname lastname
const authorName = getMetaTag(doc, "property", "cXenseParse:author", "content");
let authorName = attr(doc, "meta[name='lead:author']", "content");
if (!authorName) {
authorName = text(doc, '.info-opinion .columnnist-name a');
}
if (authorName) {
item.creators = [ZU.cleanAuthor(authorName, "author", false)];
}
// Date is stored as a timestamp like 2020-09-07T17:37:00+07:00, just extract the YYYY-MM-DD at start
const date = getMetaTag(doc, "name", "cXenseParse:recs:publishtime", "content");
const date = attr(doc, "meta[name='lead:published_at']", "content");
if (date) {
item.date = date.substr(0, 10);
}
@ -73,7 +70,9 @@ function scrape(doc, _url) {
item.complete();
});
translator.translate();
}/** BEGIN TEST CASES **/
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
@ -91,6 +90,7 @@ var testCases = [
],
"date": "2020-09-07",
"abstractNote": "A general debate without a vote in the House of Representatives has been scheduled for Wednesday for MPs to question the government on the current economic and political crises and suggest ways of solving related problems.",
"language": "en",
"libraryCatalog": "www.bangkokpost.com",
"publicationTitle": "Bangkok Post",
"url": "https://www.bangkokpost.com/thailand/politics/1981267/house-general-debate-set-for-wednesday",
@ -121,7 +121,7 @@ var testCases = [
},
{
"type": "web",
"url": "https://www.bangkokpost.com/tech/1979315/air-force-satellite-napa-1-launched",
"url": "https://www.bangkokpost.com/life/tech/1979315/air-force-satellite-napa-1-launched",
"items": [
{
"itemType": "newspaperArticle",
@ -135,9 +135,10 @@ var testCases = [
],
"date": "2020-09-03",
"abstractNote": "The Royal Thai Air Forces first security satellite, Napa-1, was successfully launched on a European rocket from French Guiana on Thursday morning.",
"language": "en",
"libraryCatalog": "www.bangkokpost.com",
"publicationTitle": "Bangkok Post",
"url": "https://www.bangkokpost.com/tech/1979315/air-force-satellite-napa-1-launched",
"url": "https://www.bangkokpost.com/life/tech/1979315/air-force-satellite-napa-1-launched",
"attachments": [
{
"title": "Snapshot",
@ -181,7 +182,8 @@ var testCases = [
}
],
"date": "2020-09-08",
"abstractNote": "Southeast Asia relies heavily on tourism. In 2019, the travel and tourism industry contributed 12.1% of the region's GDP and approximately one in 10 people are employed within and around it, according to the World Travel and Tourism Council (WTTC).",
"abstractNote": "Southeast Asia relies heavily on tourism. In 2019, the travel and tourism industry contributed 12.1% of the region",
"language": "en",
"libraryCatalog": "www.bangkokpost.com",
"publicationTitle": "Bangkok Post",
"url": "https://www.bangkokpost.com/opinion/opinion/1981587/tech-is-key-to-rebooting-tourism",

175
Baruch Foundation.js Normal file
View File

@ -0,0 +1,175 @@
{
"translatorID": "283d6b78-d3d7-48d4-8fc0-0bdabef7c4ee",
"label": "Baruch Foundation",
"creator": "Abe Jellinek",
"target": "^https?://baruchfoundation\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-20 18:55:13"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, _url) {
if (doc.querySelector('#img-artist')) {
return "artwork";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h4 > a[href*=".jpg.php"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
let item = new Zotero.Item('artwork');
item.title = text(doc, 'h1#title b');
item.abstractNote = text(doc, '.description');
item.artworkMedium = [...doc.querySelectorAll('.taglist a')]
.map(a => a.innerText.trim()).join(', ');
item.artworkSize = text(doc, '.zp_uneditable_image_location'); // not sure why this class
item.date = text(doc, '.zp_uneditable_image_city'); // again...
if (item.date.trim() == 'no date') item.date = '';
item.archive = 'Baruch Foundation';
item.url = url;
item.rights = text(doc, '.credit');
item.creators.push(ZU.cleanAuthor(
text(doc, '#img-artist em').replace(/^Dr\.?\b/, ''),
'artist'
));
item.attachments.push({
title: 'Image',
mimeType: 'image/jpeg',
url: attr(doc, '#img-full', 'href')
});
item.complete();
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://baruchfoundation.org/banka/banka_portrait-with-coiled-wire.jpg.php",
"items": [
{
"itemType": "artwork",
"title": "Portrait with Coiled Wire",
"creators": [
{
"firstName": "Pavel",
"lastName": "Baňka",
"creatorType": "artist"
}
],
"date": "1986",
"archive": "Baruch Foundation",
"artworkMedium": "Gelatin Silver Print, Toned Photograph",
"artworkSize": "12 1/4 x 15 5/16 in.",
"libraryCatalog": "Baruch Foundation",
"url": "http://baruchfoundation.org/banka/banka_portrait-with-coiled-wire.jpg.php",
"attachments": [
{
"title": "Image",
"mimeType": "image/jpeg"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://baruchfoundation.org/j_feyfar/j_feyfar_untitled-stream-in-woods.jpg.php",
"items": [
{
"itemType": "artwork",
"title": "Untitled (Wooded Landscape with Stream)",
"creators": [
{
"firstName": "Jaroslav",
"lastName": "Feyfar",
"creatorType": "artist"
}
],
"abstractNote": "on blue mount",
"archive": "Baruch Foundation",
"artworkMedium": "Black And White Photograph, Gelatin Silver Print",
"artworkSize": "4 3/4 x 3 1/2 in.",
"libraryCatalog": "Baruch Foundation",
"url": "http://baruchfoundation.org/j_feyfar/j_feyfar_untitled-stream-in-woods.jpg.php",
"attachments": [
{
"title": "Image",
"mimeType": "image/jpeg"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://baruchfoundation.org/balcar",
"items": "multiple"
}
]
/** END TEST CASES **/

View File

@ -1,7 +1,7 @@
{
"translatorID": "a571680e-6338-46c2-a740-3cd9eb80fc7f",
"label": "Beobachter",
"creator": "ibex",
"creator": "Sebastian Karcher",
"target": "^https?://((www\\.)?beobachter\\.ch/.)",
"minVersion": "2.1.9",
"maxVersion": "",
@ -9,177 +9,96 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-09-07 21:24:35"
"lastUpdated": "2022-02-05 20:11:36"
}
/*
Beobachter Translator - Parses Beobachter articles and creates Zotero-based
metadata.
Copyright (C) 2011 ibex
***** BEGIN LICENSE BLOCK *****
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Copyright © 2022 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
/*
Reference URLs:
Article: http://www.beobachter.ch/natur/natuerlich-leben/wohnen-freizeit/artikel/beleuchtung_es-werde-led/
Topic list: http://www.beobachter.ch/natur/forschung-wissen/
*/
/* Zotero API */
function detectWeb(doc, url) {
// Z.debug("ibex detectWeb URL = " + url);
if (doc.location.href.match(/.*\/artikel\//i) && (ZU.xpath(doc, '//div[' + containingClass('mediaarticleSingleView') + ']//h3').length > 0)) {
function detectWeb(doc, _url) {
if (doc.getElementsByClassName('article-header').length > 0) {
return "magazineArticle";
// AJAX-ified results are currently not compatible with Zotero.
// The following condition is not useful:
// http://forums.zotero.org/discussion/18518/import-citation-from-an-ajaxbased-site/
// } else if (doc.location.href.match(/\/suche\//i) && (ZU.xpath(doc, '//div[@id = "multiSerachListContainer"]') + ']').length > 0)) {
} else if (ZU.xpath(doc, '//html/body[' + containingClass('article') + ']').length > 0) {
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('a[class*="teaser"]');
for (let row of rows) {
let href = row.href;
let title = text(row, 'span');
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
/* Zotero API */
function doWeb(doc, url) {
// Z.debug("ibex doWeb URL = " + url);
var urls = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = ZU.getItemArray(doc, doc.getElementById("mainContent").getElementsByTagName('h3'), '.*');
if (!items || countObjectProperties(items) == 0) {
return true;
}
items = Z.selectItems(items);
if (!items) {
return true;
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var authors = doc.querySelectorAll('meta[name="parsely-author"]');
var date = attr(doc, 'meta[name="published_at"]', 'content');
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
// translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
for (let author of authors) {
item.creators.push(ZU.cleanAuthor(author.content, "author"));
}
item.title = item.title.replace(/\s*\|\s*Beobachter/, "");
item.date = date;
item.ISSN = "1661-7444";
item.complete();
});
for (var i in items) {
urls.push(i);
}
} else {
urls.push(doc.location.href);
}
ZU.processDocuments(urls, scrape);
translator.getTranslatorObject(function (trans) {
trans.itemType = "magazineArticle";
trans.doWeb(doc, url);
});
}
/* Zotero API */
function scrape(doc) {
// Z.debug("ibex scrape URL = " + doc.location.href);
// Fetch meta tags and fill meta tag array for associateMeta() function
var metaTags = fetchMeta(doc);
var newItem = new Z.Item('magazineArticle');
newItem.url = doc.location.href;
var shortTitle = ZU.xpath(doc, '//div[' + containingClass('mediaarticleSingleView') + ']//h3');
if (shortTitle.length > 0) {
newItem.shortTitle = ZU.trimInternal(shortTitle[0].textContent);
}
associateMeta(newItem, metaTags, "DC.title", "title");
associateMeta(newItem, metaTags, "DC.date", "date");
associateMeta(newItem, metaTags, "publisher", "publicationTitle");
associateMeta(newItem, metaTags, "abstract", "abstractNote");
associateMeta(newItem, metaTags, "DC.Language", "language");
// Other potentially usful meta data: DC.keywords
newItem.ISSN = "1661-7444";
var authorline = ZU.xpath(doc, '//div[' + containingClass('mediaarticleSingleView') + ']//dl/dt[. = "Autor:"]');
if (authorline.length > 0) {
authorline = ZU.trimInternal(authorline[0].nextSibling.textContent);
// Assumption of authorline: "name1[, name2] [und Name3]"
var authors = authorline.split(/,|und/);
for (var i = 0; i < authors.length && authorline.length > 0; i++) {
newItem.creators.push(ZU.cleanAuthor(authors[i], "author"));
}
}
var issueDt = ZU.xpath(doc, '//div[' + containingClass('mediaarticleSingleView') + ']//dl/dt[. = "Ausgabe:"]');
if (issueDt.length > 0) {
issueArray = issueDt[0].nextSibling.textContent.split("/");
newItem.issue = ZU.trimInternal(issueArray[0]);
newItem.volume = ZU.trimInternal(issueArray[1]);
}
// A print dialog is shown to the user. The print page listens to the
// onload JavaScriptevent and executes window.print().
// I do not know how to disable this behaviour.
newItem.attachments.push({title: "Beobachter Article Snapshot", mimeType: "text/html", url: doc.location.href + "/print.html", snapshot: true});
newItem.complete();
}
/*
* There is no built-in function to count object properties which often are used as associative arrays.
*
* @param {Object} obj Associative array
* @return {int} Number of object properties = ength of associative array
*/
function countObjectProperties(obj) {
var size = 0;
for (var key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
}
/**
* Fetch meta tags and fill meta tag array for associateMeta() function
*
* @param {element} doc Document DOM
* @return {Object} Associative array (Object) of meta tags, array[name] = value
*/
function fetchMeta(doc) {
var metaTagHTML = doc.getElementsByTagName("meta");
var metaTags = new Object();
for (var i = 0 ; i < metaTagHTML.length ; i++) {
metaTags[metaTagHTML[i].getAttribute("name")] = metaTagHTML[i].getAttribute("content");
}
return metaTags;
}
/**
* Adds an HTML meta tag to a Zotero item field.
* The meta tags array can be filled with fetchMeta() function.
*
* @param {Object} newItem The Zotero item
* @param {Object} metaTags Associative array (Object) of meta tags, array[name] = value
* @param {String} name The meta tag name
* @param {String} zoteroField The Zotero field name in the Zotero item.
* @return {null} Nothing is returned
*/
function associateMeta(newItem, metaTags, name, zoteroField) {
if (metaTags[name]) {
newItem[zoteroField] = ZU.trimInternal(ZU.unescapeHTML(metaTags[name]));
}
}
/**
* Generates a partial xpath expression that matches an element whose 'class' attribute
* contains the given CSS className. So to match &lt;div class='foo bar'&gt; you would
* say "//div[" + containingClass("foo") + "]".
*
* Reference: http://pivotallabs.com/users/alex/blog/articles/427-xpath-css-class-matching
*
* @param {String} className CSS class name
* @return {String} XPath fragment
*/
function containingClass(className) {
return "contains(concat(' ',normalize-space(@class),' '),' " + className + " ')";
}/** BEGIN TEST CASES **/
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
@ -188,10 +107,11 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.beobachter.ch/natur/forschung-wissen/klima-wetter/artikel/blitzschlag_suche-nicht-die-buche/",
"url": "https://www.beobachter.ch/umwelt/blitze-suche-nicht-die-buche",
"items": [
{
"itemType": "magazineArticle",
"title": "Blitze: Suche nicht die Buche!",
"creators": [
{
"firstName": "Tanja",
@ -199,27 +119,55 @@ var testCases = [
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"date": "2013-08-16T16:28:50+02:00",
"ISSN": "1661-7444",
"abstractNote": "Acht Tipps, was man tun und lassen soll, wenn man von Blitz und Donner überrascht wird.",
"language": "de-CH",
"libraryCatalog": "www.beobachter.ch",
"shortTitle": "Blitze",
"url": "https://www.beobachter.ch/umwelt/blitze-suche-nicht-die-buche",
"attachments": [
{
"title": "Beobachter Article Snapshot",
"mimeType": "text/html",
"snapshot": true
"title": "Snapshot",
"mimeType": "text/html"
}
],
"url": "http://www.beobachter.ch/natur/forschung-wissen/klima-wetter/artikel/blitzschlag_suche-nicht-die-buche/",
"shortTitle": "Neun Tipps, was man tun und lassen soll, wenn man von Blitz und Donner überrascht wird.",
"title": "Blitze: Suche nicht die Buche!",
"publicationTitle": "Beobachter",
"abstractNote": "Neun Tipps, was man tun und lassen soll, wenn man von Blitz und Donner überrascht wird.",
"language": "de",
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.beobachter.ch/gesundheit/medizin-krankheit/immer-schlapp-wieso-fuhlen-wir-uns-standig-mude",
"items": [
{
"itemType": "magazineArticle",
"title": "Immer schlapp: Wieso fühlen wir uns ständig müde?",
"creators": [
{
"firstName": "Andreas",
"lastName": "Grote",
"creatorType": "author"
}
],
"date": "2022-01-11T09:30:00+01:00",
"ISSN": "1661-7444",
"issue": "23. August 2013, Beobachter 17",
"volume": "2013",
"libraryCatalog": "Beobachter",
"accessDate": "CURRENT_TIMESTAMP"
"abstractNote": "Wer andauernd schläfrig und erschöpft ist, leidet und nervt andere. Ein kurzer Selbsttest zeigt, ob Ihre Müdigkeit normal ist und was dagegen helfen kann.",
"language": "de-CH",
"libraryCatalog": "www.beobachter.ch",
"shortTitle": "Immer schlapp",
"url": "https://www.beobachter.ch/gesundheit/medizin-krankheit/immer-schlapp-wieso-fuhlen-wir-uns-standig-mude",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}

View File

@ -1,13 +1,11 @@
{
"translatorID": "b6e39b57-8942-4d11-8259-342c46ce395f",
"translatorType": 2,
"label": "BibLaTeX",
"creator": "Simon Kornblith, Richard Karnesky and Anders Johansson",
"target": "bib",
"minVersion": "2.1.9",
"maxVersion": "null",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"configOptions": {
"getCollections": true
},
@ -17,7 +15,9 @@
"exportFileData": false,
"useJournalAbbreviation": false
},
"lastUpdated": "2019-12-15 14:26:00"
"inRepository": true,
"translatorType": 2,
"lastUpdated": "2024-03-25 14:49:42"
}
/*
@ -371,7 +371,7 @@ var numberRe = /^[0-9]+/;
// it includes the indefinite articles of English, German, French and Spanish, as well as a small set of English prepositions whose
// force is more grammatical than lexical, i.e. which are likely to strike many as 'insignificant'.
// The assumption is that most who want a title word in their key would prefer the first word of significance.
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l'|el|las|los|al|uno|una|unos|unas|de|des|del|d')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style="small-caps"|span)>)/g;
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l'|les|el|las|los|al|uno|una|unos|unas|de|des|del|d')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style="small-caps"|span)>)/g;
var citeKeyConversionsRe = /%([a-zA-Z])/;
var citeKeyConversions = {
@ -484,6 +484,12 @@ function encodeFilePathComponent(value) {
return value.replace(encodeFilePathRE, "\\$&");
}
// We strip out {} in general, because \{ and \} break BibLaTeX
function cleanFilePath(str) {
if (!str) return '';
return str.replace(/(?:\s*[{}]+)+\s*/g, ' ');
}
function doExport() {
// Zotero.write("% biblatex export generated by Zotero "+Zotero.Utilities.getVersion());
// to make sure the BOM gets ignored
@ -848,16 +854,21 @@ function doExport() {
for (let i = 0; i < item.attachments.length; i++) {
var attachment = item.attachments[i];
var title = cleanFilePath(attachment.title),
path = null;
if (Zotero.getOption("exportFileData") && attachment.saveFile) {
attachment.saveFile(attachment.defaultPath, true);
attachmentString += ";" + encodeFilePathComponent(attachment.title) + ":"
+ encodeFilePathComponent(attachment.defaultPath) + ":"
+ encodeFilePathComponent(attachment.mimeType);
path = cleanFilePath(attachment.defaultPath);
attachment.saveFile(path, true);
}
else if (attachment.localPath) {
attachmentString += ";" + encodeFilePathComponent(attachment.title) + ":"
+ encodeFilePathComponent(attachment.localPath) + ":"
+ encodeFilePathComponent(attachment.mimeType);
path = cleanFilePath(attachment.localPath);
}
if (path) {
attachmentString += ";" + encodeFilePathComponent(title)
+ ":" + encodeFilePathComponent(path)
+ ":" + encodeFilePathComponent(attachment.mimeType);
}
}
@ -868,4 +879,10 @@ function doExport() {
Zotero.write(",\n}");
}
Zotero.write("\n");
}
/** BEGIN TEST CASES **/
var testCases = [
]
/** END TEST CASES **/

399
BibTeX.js
View File

@ -18,7 +18,7 @@
},
"inRepository": true,
"translatorType": 3,
"lastUpdated": "2020-03-13 03:07:49"
"lastUpdated": "2024-03-25 14:51:02"
}
/*
@ -152,6 +152,28 @@ var eprintIds = {
'googlebooks': 'GoogleBooksID'
};
function dateFieldsToDate(year, month, day) {
// per the latest ISO 8601 standard, you can't have a month/day without a
// year (and it would be silly anyway)
if (year) {
let date = year;
if (month) {
if (month.includes(date)) {
date = month;
}
else {
date += `-${month}`;
}
if (day) {
date += `-${day}`;
}
}
return ZU.strToISO(date);
}
return false;
}
function parseExtraFields(extra) {
var lines = extra.split(/[\r\n]+/);
var fields = [];
@ -226,7 +248,7 @@ var bibtex2zoteroTypeMap = {
"booklet":"book",
"manual":"book",
"mastersthesis":"thesis",
"misc":"book",
"misc":"document",
"proceedings":"book",
"online":"webpage",
// alias for online from BibLaTeX:
@ -304,6 +326,9 @@ function processField(item, field, value, rawValue) {
if (field == "doi" &&!ZU.fieldIsValidForType("DOI", item.itemType) && ZU.cleanDOI(value)) {
item._extraFields.push({field: "DOI", value: ZU.cleanDOI(value)});
}
if (field == "url") { // pass raw values for URL
item.url = rawValue;
}
else {
item[fieldMap[field]] = value;
}
@ -380,33 +405,20 @@ function processField(item, field, value, rawValue) {
} else {
item.issue = value;
}
} else if (field == "day") {
// this and the following two blocks assign to temporary fields that
// are cleared before the item is completed. "day" isn't an official
// field, but some sites use it.
item.day = value;
} else if (field == "month") {
var monthIndex = months.indexOf(value.toLowerCase());
if (monthIndex != -1) {
value = Zotero.Utilities.formatDate({month:monthIndex});
} else {
value += " ";
}
if (item.date) {
if (value.includes(item.date)) {
// value contains year and more
item.date = value;
} else {
item.date = value+item.date;
}
} else {
item.date = value;
}
item.month = value;
} else if (field == "year") {
if (item.date) {
if (!item.date.includes(value)) {
// date does not already contain year
item.date += value;
}
} else {
item.date = value;
}
item.year = value;
} else if (field == "date") {
//We're going to assume that "date" and the date parts don't occur together. If they do, we pick date, which should hold all.
item.date = value;
@ -672,6 +684,7 @@ function unescapeBibTeX(value) {
value = value.replace(mapped, unicode);
}
}
value = value.replace(/\$([^$]+)\$/g, '$1')
// kill braces
value = value.replace(/([^\\])[{}]+/g, "$1");
@ -858,6 +871,10 @@ function beginRecord(type, closeChar) {
}
var item = new Zotero.Item(zoteroType);
item._extraFields = [];
}
else if (type == "preamble") { // Preamble (keeping separate in case we want to do something with these)
Zotero.debug("discarded preamble from BibTeX");
return;
}
// For theses write the thesisType determined by the BibTeX type.
@ -960,6 +977,13 @@ function beginRecord(type, closeChar) {
delete item.backupLocation;
}
if (!item.date) {
item.date = dateFieldsToDate(item.year, item.month, item.day);
}
delete item.year;
delete item.month;
delete item.day;
item.extra = extraFieldsToString(item._extraFields);
delete item._extraFields;
@ -1048,6 +1072,7 @@ function readString(resolve, reject) {
function writeField(field, value, isMacro) {
if (!value && typeof value != "number") return;
value = value + ""; // convert integers to strings
Zotero.write(",\n\t" + field + " = ");
if (!isMacro) Zotero.write("{");
// url field is preserved, for use with \href and \url
@ -1060,7 +1085,8 @@ function writeField(field, value, isMacro) {
value = ZU.XRegExp.replace(value, protectCapsRE, "$1{$2$3}"); // only $2 or $3 will have a value, not both
}
}
if (Zotero.getOption("exportCharset") != "UTF-8") {
var exportCharset = Zotero.getOption("exportCharset");
if (exportCharset && !exportCharset.startsWith("UTF-8")) {
value = value.replace(/[\u0080-\uFFFF]/g, mapAccent);
}
//convert the HTML markup allowed in Zotero for rich text to TeX; excluding doi/url/file shouldn't be necessary, but better to be safe;
@ -1084,15 +1110,23 @@ function mapHTMLmarkup(characters){
return characters;
}
function xcase(prefix, cased, tag, tex) {
return (prefix ? `$${prefix}$` : '') + (reversemappingTable[`$${tex}{${cased}}$`] || `<${tag}>${cased}</${tag}>`)
}
function sup(match, prefix, cased) {
return xcase(prefix, cased, 'sup', '^');
}
function sub(match, prefix, cased) {
return xcase(prefix, cased, 'sub', '_');
}
function mapTeXmarkup(tex){
//reverse of the above - converts tex mark-up into html mark-up permitted by Zotero
//italics and bold
tex = tex.replace(/\\textit\{([^\}]+\})/g, "<i>$1</i>").replace(/\\textbf\{([^\}]+\})/g, "<b>$1</b>");
//two versions of subscript the .* after $ is necessary because people m
tex = tex.replace(/\$[^\{\$]*_\{([^\}]+\})\$/g, "<sub>$1</sub>").replace(/\$[^\{]*_\{\\textrm\{([^\}]+\}\})/g, "<sub>$1</sub>");
tex = tex.replace(/\$([^\{\$]*)_\{([^\}]+)\}\$/g, sub).replace(/\$([^\{\$]*)_\{\\textrm\{([^\}\$]+)\}\}\$/g, sub);
//two version of superscript
tex = tex.replace(/\$[^\{]*\^\{([^\}]+\}\$)/g, "<sup>$1</sup>").replace(/\$[^\{]*\^\{\\textrm\{([^\}]+\}\})/g, "<sup>$1</sup>");
tex = tex.replace(/\$([^\{\$]*)\^\{([^\}]+)\}\$/g, sup).replace(/\$([^\{\$]*)\^\{\\textrm\{([^\}]+)\}\}\$/g, sup);
//small caps
tex = tex.replace(/\\textsc\{([^\}]+)/g, "<span style=\"small-caps\">$1</span>");
return tex;
@ -1208,7 +1242,7 @@ var numberRe = /^[0-9]+/;
// force is more grammatical than lexical, i.e. which are likely to strike many as 'insignificant'.
// The assumption is that most who want a title word in their key would prefer the first word of significance.
// Also remove markup
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l\'|el|las|los|al|uno|una|unos|unas|de|des|del|d\')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style=\"small-caps\"|span)>)/g;
var citeKeyTitleBannedRe = /\b(a|an|the|some|from|on|in|to|of|do|with|der|die|das|ein|eine|einer|eines|einem|einen|un|une|la|le|l\'|les|el|las|los|al|uno|una|unos|unas|de|des|del|d\')(\s+|\b)|(<\/?(i|b|sup|sub|sc|span style=\"small-caps\"|span)>)/g;
var citeKeyConversionsRe = /%([a-zA-Z])/;
var citeKeyConversions = {
@ -2630,6 +2664,7 @@ var reversemappingTable = {
"{\\textunderscore}" : "\u2017", // DOUBLE LOW LINE
"{\\textquoteleft}" : "\u2018", // LEFT SINGLE QUOTATION MARK
"{\\textquoteright}" : "\u2019", // RIGHT SINGLE QUOTATION MARK
"{\\textquotesingle}" : "'", // APOSTROPHE / NEUTRAL SINGLE QUOTATION MARK
"{\\quotesinglbase}" : "\u201A", // SINGLE LOW-9 QUOTATION MARK
"{\\textquotedblleft}" : "\u201C", // LEFT DOUBLE QUOTATION MARK
"{\\textquotedblright}" : "\u201D", // RIGHT DOUBLE QUOTATION MARK
@ -2756,6 +2791,7 @@ var reversemappingTable = {
"{\\~A}" : "\u00C3", // LATIN CAPITAL LETTER A WITH TILDE
"{\\\"A}" : "\u00C4", // LATIN CAPITAL LETTER A WITH DIAERESIS
"{\\r A}" : "\u00C5", // LATIN CAPITAL LETTER A WITH RING ABOVE
"{\\AA}" : "\u00C5", // LATIN CAPITAL LETTER A WITH RING ABOVE
"{\\c C}" : "\u00C7", // LATIN CAPITAL LETTER C WITH CEDILLA
"{\\`E}" : "\u00C8", // LATIN CAPITAL LETTER E WITH GRAVE
"{\\'E}" : "\u00C9", // LATIN CAPITAL LETTER E WITH ACUTE
@ -2782,6 +2818,7 @@ var reversemappingTable = {
"{\\~a}" : "\u00E3", // LATIN SMALL LETTER A WITH TILDE
"{\\\"a}" : "\u00E4", // LATIN SMALL LETTER A WITH DIAERESIS
"{\\r a}" : "\u00E5", // LATIN SMALL LETTER A WITH RING ABOVE
"{\\aa}" : "\u00E5", // LATIN SMALL LETTER A WITH RING ABOVE
"{\\c c}" : "\u00E7", // LATIN SMALL LETTER C WITH CEDILLA
"{\\`e}" : "\u00E8", // LATIN SMALL LETTER E WITH GRAVE
"{\\'e}" : "\u00E9", // LATIN SMALL LETTER E WITH ACUTE
@ -2859,8 +2896,8 @@ var reversemappingTable = {
"{\\c l}" : "\u013C", // LATIN SMALL LETTER L WITH CEDILLA
"{\\v L}" : "\u013D", // LATIN CAPITAL LETTER L WITH CARON
"{\\v l}" : "\u013E", // LATIN SMALL LETTER L WITH CARON
"{\\L }" : "\u0141", //LATIN CAPITAL LETTER L WITH STROKE
"{\\l }" : "\u0142", //LATIN SMALL LETTER L WITH STROKE
"{\\L}" : "\u0141", //LATIN CAPITAL LETTER L WITH STROKE
"{\\l}" : "\u0142", //LATIN SMALL LETTER L WITH STROKE
"{\\'N}" : "\u0143", // LATIN CAPITAL LETTER N WITH ACUTE
"{\\'n}" : "\u0144", // LATIN SMALL LETTER N WITH ACUTE
"{\\c N}" : "\u0145", // LATIN CAPITAL LETTER N WITH CEDILLA
@ -3213,7 +3250,7 @@ var testCases = [
"creatorType": "editor"
}
],
"date": "October 2006",
"date": "2006-10",
"itemID": "conference:06",
"attachments": [],
"tags": [],
@ -3298,7 +3335,7 @@ var testCases = [
"items": [
{
"itemType": "journalArticle",
"title": "Test of markupconversion: Italics, bold, superscript, subscript, and small caps: Mitochondrial DNA<sub>2</sub>$ sequences suggest unexpected phylogenetic position of Corso-Sardinian grass snakes (<i>Natrix cetti</i>) and <b>do not</b> support their <span style=\"small-caps\">species status</span>, with notes on phylogeography and subspecies delineation of grass snakes.",
"title": "Test of markupconversion: Italics, bold, superscript, subscript, and small caps: Mitochondrial DNA sequences suggest unexpected phylogenetic position of Corso-Sardinian grass snakes (<i>Natrix cetti</i>) and <b>do not</b> support their <span style=\"small-caps\">species status</span>, with notes on phylogeography and subspecies delineation of grass snakes.",
"creators": [
{
"firstName": "U.",
@ -3320,7 +3357,7 @@ var testCases = [
"DOI": "10.1007/s13127-011-0069-8",
"itemID": "Frit2",
"pages": "71-80",
"publicationTitle": "Actes du <sup>ème</sup>$ Congrès Français d'Acoustique",
"publicationTitle": "Actes du 4<sup>ème</sup> Congrès Français d'Acoustique",
"volume": "12",
"attachments": [],
"tags": [],
@ -3334,7 +3371,7 @@ var testCases = [
"input": "@misc{american_rights_at_work_public_2012,\n title = {Public Service Research Foundation},\n\turl = {http://www.americanrightsatwork.org/blogcategory-275/},\n\turldate = {2012-07-27},\n\tauthor = {American Rights at Work},\n\tyear = {2012},\n\thowpublished = {http://www.americanrightsatwork.org/blogcategory-275/},\n}",
"items": [
{
"itemType": "book",
"itemType": "document",
"title": "Public Service Research Foundation",
"creators": [
{
@ -3597,7 +3634,7 @@ var testCases = [
"fieldMode": 1
}
],
"date": "March 2013",
"date": "2013-03",
"DOI": "10.1161/CIR.0b013e318288b4dd",
"ISSN": "1524-4539",
"extra": "PMID: 23439512",
@ -3610,16 +3647,36 @@ var testCases = [
"volume": "127",
"attachments": [],
"tags": [
"Administrative Personnel",
"American Heart Association",
"Cardiopulmonary Resuscitation",
"Community Health Services",
"Health Personnel",
"Heart Arrest",
"Humans",
"Leadership",
"Public Health",
"United States"
{
"tag": "Administrative Personnel"
},
{
"tag": "American Heart Association"
},
{
"tag": "Cardiopulmonary Resuscitation"
},
{
"tag": "Community Health Services"
},
{
"tag": "Health Personnel"
},
{
"tag": "Heart Arrest"
},
{
"tag": "Humans"
},
{
"tag": "Leadership"
},
{
"tag": "Public Health"
},
{
"tag": "United States"
}
],
"notes": [],
"seeAlso": []
@ -3913,7 +3970,7 @@ var testCases = [
"creatorType": "author"
}
],
"date": "März 1942",
"date": "1942-03",
"itemID": "sweig42",
"publisher": "D\\ëad Po<sub>eee</sub>t Society",
"attachments": [],
@ -3922,6 +3979,258 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "import",
"input": "@preamble{BibTeX for papers by David Kotz; for complete/updated list see\nhttps://www.cs.dartmouth.edu/~kotz/research/papers.html}\n\n@Article{batsis:rural,\n author = {John A. Batsis and Curtis L. Petersen and Matthew M. Clark and Summer B. Cook and David Kotz and Tyler L. Gooding and Meredith N. Roderka and Rima I. Al-Nimr and Dawna M. Pidgeon and Ann Haedrich and KC Wright and Christina Aquila and Todd A. Mackenzie},\n title = {A Rural Mobile Health Obesity Wellness Intervention for Older Adults with Obesity},\n journal = {BMC Geriatrics},\n year = 2020,\n month = {December},\n copyright = {the authors},\n URL = {https://www.cs.dartmouth.edu/~kotz/research/batsis-rural/index.html},\n note = {Accepted for publication},\n}\n",
"items": [
{
"itemType": "journalArticle",
"title": "A Rural Mobile Health Obesity Wellness Intervention for Older Adults with Obesity",
"creators": [
{
"firstName": "John A.",
"lastName": "Batsis",
"creatorType": "author"
},
{
"firstName": "Curtis L.",
"lastName": "Petersen",
"creatorType": "author"
},
{
"firstName": "Matthew M.",
"lastName": "Clark",
"creatorType": "author"
},
{
"firstName": "Summer B.",
"lastName": "Cook",
"creatorType": "author"
},
{
"firstName": "David",
"lastName": "Kotz",
"creatorType": "author"
},
{
"firstName": "Tyler L.",
"lastName": "Gooding",
"creatorType": "author"
},
{
"firstName": "Meredith N.",
"lastName": "Roderka",
"creatorType": "author"
},
{
"firstName": "Rima I.",
"lastName": "Al-Nimr",
"creatorType": "author"
},
{
"firstName": "Dawna M.",
"lastName": "Pidgeon",
"creatorType": "author"
},
{
"firstName": "Ann",
"lastName": "Haedrich",
"creatorType": "author"
},
{
"firstName": "K. C.",
"lastName": "Wright",
"creatorType": "author"
},
{
"firstName": "Christina",
"lastName": "Aquila",
"creatorType": "author"
},
{
"firstName": "Todd A.",
"lastName": "Mackenzie",
"creatorType": "author"
}
],
"date": "2020-12",
"itemID": "batsis:rural",
"publicationTitle": "BMC Geriatrics",
"rights": "the authors",
"url": "https://www.cs.dartmouth.edu/~kotz/research/batsis-rural/index.html",
"attachments": [],
"tags": [],
"notes": [
{
"note": "<p>Accepted for publication</p>"
}
],
"seeAlso": []
}
]
},
{
"type": "import",
"input": "@techreport{ietf-bmwg-evpntest-09,\n\tnumber =\t{draft-ietf-bmwg-evpntest-09},\n\ttype =\t\t{Internet-Draft},\n\tinstitution =\t{Internet Engineering Task Force},\n\tpublisher =\t{Internet Engineering Task Force},\n\tnote =\t\t{Work in Progress},\n\turl =\t\t{https://datatracker.ietf.org/doc/html/draft-ietf-bmwg-evpntest-09},\n author =\t{sudhin jacob and Kishore Tiruveedhula},\n\ttitle =\t\t{{Benchmarking Methodology for EVPN and PBB-EVPN}},\n\tpagetotal =\t28,\n\tyear =\t\t2021,\n\tmonth =\t\tjun,\n\tday =\t\t18,\n\tabstract =\t{This document defines methodologies for benchmarking EVPN and PBB- EVPN performance. EVPN is defined in RFC 7432, and is being deployed in Service Provider networks. Specifically, this document defines the methodologies for benchmarking EVPN/PBB-EVPN convergence, data plane performance, and control plane performance.},\n}\n",
"items": [
{
"itemType": "report",
"title": "Benchmarking Methodology for EVPN and PBB-EVPN",
"creators": [
{
"firstName": "sudhin",
"lastName": "jacob",
"creatorType": "author"
},
{
"firstName": "Kishore",
"lastName": "Tiruveedhula",
"creatorType": "author"
}
],
"date": "2021-06-18",
"abstractNote": "This document defines methodologies for benchmarking EVPN and PBB- EVPN performance. EVPN is defined in RFC 7432, and is being deployed in Service Provider networks. Specifically, this document defines the methodologies for benchmarking EVPN/PBB-EVPN convergence, data plane performance, and control plane performance.",
"institution": "Internet Engineering Task Force",
"itemID": "ietf-bmwg-evpntest-09",
"reportNumber": "draft-ietf-bmwg-evpntest-09",
"reportType": "Internet-Draft",
"url": "https://datatracker.ietf.org/doc/html/draft-ietf-bmwg-evpntest-09",
"attachments": [],
"tags": [],
"notes": [
{
"note": "<p>Work in Progress</p>"
}
],
"seeAlso": []
}
]
},
{
"type": "import",
"input": "@inproceedings{NIPS2009_0188e8b8,\n author = {Cuturi, Marco and Vert, Jean-philippe and D\\textquotesingle aspremont, Alexandre},\n booktitle = {Advances in Neural Information Processing Systems},\n editor = {Y. Bengio and D. Schuurmans and J. Lafferty and C. Williams and A. Culotta},\n pages = {},\n publisher = {Curran Associates, Inc.},\n title = {White Functionals for Anomaly Detection in Dynamical Systems},\n url = {https://proceedings.neurips.cc/paper/2009/file/0188e8b8b014829e2fa0f430f0a95961-Paper.pdf},\n volume = {22},\n year = {2009}\n}",
"items": [
{
"itemType": "conferencePaper",
"title": "White Functionals for Anomaly Detection in Dynamical Systems",
"creators": [
{
"firstName": "Marco",
"lastName": "Cuturi",
"creatorType": "author"
},
{
"firstName": "Jean-philippe",
"lastName": "Vert",
"creatorType": "author"
},
{
"firstName": "Alexandre",
"lastName": "D' aspremont",
"creatorType": "author"
},
{
"firstName": "Y.",
"lastName": "Bengio",
"creatorType": "editor"
},
{
"firstName": "D.",
"lastName": "Schuurmans",
"creatorType": "editor"
},
{
"firstName": "J.",
"lastName": "Lafferty",
"creatorType": "editor"
},
{
"firstName": "C.",
"lastName": "Williams",
"creatorType": "editor"
},
{
"firstName": "A.",
"lastName": "Culotta",
"creatorType": "editor"
}
],
"date": "2009",
"itemID": "NIPS2009_0188e8b8",
"proceedingsTitle": "Advances in Neural Information Processing Systems",
"publisher": "Curran Associates, Inc.",
"url": "https://proceedings.neurips.cc/paper/2009/file/0188e8b8b014829e2fa0f430f0a95961-Paper.pdf",
"volume": "22",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "import",
"input": "@article{Borissov:2855446,\r\n author = \"Borissov, Alexander and Solokhin, Sergei\",\r\n collaboration = \"ALICE\",\r\n title = \"{Production of $\\Sigma^{0}$ Hyperon and Search of\r\n $\\Sigma^{0}$ Hypernuclei at LHC with ALICE}\",\r\n journal = \"Phys. At. Nucl.\",\r\n volume = \"85\",\r\n number = \"6\",\r\n pages = \"970-975\",\r\n year = \"2023\",\r\n url = \"https://cds.cern.ch/record/2855446\",\r\n doi = \"10.1134/S1063778823010131\",\r\n }",
"items": [
{
"itemType": "journalArticle",
"title": "Production of Σ⁰ Hyperon and Search of Σ⁰ Hypernuclei at LHC with ALICE",
"creators": [
{
"firstName": "Alexander",
"lastName": "Borissov",
"creatorType": "author"
},
{
"firstName": "Sergei",
"lastName": "Solokhin",
"creatorType": "author"
}
],
"date": "2023",
"DOI": "10.1134/S1063778823010131",
"issue": "6",
"itemID": "Borissov:2855446",
"pages": "970-975",
"publicationTitle": "Phys. At. Nucl.",
"url": "https://cds.cern.ch/record/2855446",
"volume": "85",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "import",
"input": "@book{derbis1998poczucie,\r\ntitle={Poczucie jako{\\'s}ci {\\.z}ycia a swoboda dzia{\\l}ania i odpowiedzialno{\\'s}{\\'c}},\r\nauthor={Derbis, Romuald and Ba{\\'n}ka, Augustyn},\r\nyear={1998},\r\npublisher={Stowarzyszenie Psychologia i Architektura}\r\n}",
"items": [
{
"itemType": "book",
"title": "Poczucie jakości życia a swoboda działania i odpowiedzialność",
"creators": [
{
"firstName": "Romuald",
"lastName": "Derbis",
"creatorType": "author"
},
{
"firstName": "Augustyn",
"lastName": "Bańka",
"creatorType": "author"
}
],
"date": "1998",
"itemID": "derbis1998poczucie",
"publisher": "Stowarzyszenie Psychologia i Architektura",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

View File

@ -1,7 +1,7 @@
{
"translatorID": "9932d1a7-cc6d-4d83-8462-8f6658b13dc0",
"label": "Biblio.com",
"creator": "Adam Crymble, Michael Berkowitz, and Sebastian Karcher",
"creator": "Adam Crymble, Michael Berkowitz, Sebastian Karcher, and Abe Jellinek",
"target": "^https?://www\\.biblio\\.com/",
"minVersion": "3.0",
"maxVersion": "",
@ -9,87 +9,50 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-09-08 06:09:28"
"lastUpdated": "2021-07-14 21:52:42"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (doc.location.href.match("bookseller_search") || doc.location.href.match("bookstores") || doc.location.href.match("textbooks")) {
} else if (doc.location.href.search(/\/search\.php/)!=-1) {
return "multiple";
} else if (doc.location.href.search(/\/book/)!=-1) {
if (url.includes('/book/')) {
return "book";
}
}
//Biblio.com translator. Code by Adam Crymble.
function associateData (newItem, dataTags, field, zoteroField) {
if (dataTags[field]) {
newItem[zoteroField] = dataTags[field];
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function scrape(doc, url) {
var dataTags = new Object();
var contents = new Array();
var multiAuthors = new Array();
var fieldTitle;
var author1;
var newItem = new Zotero.Item("book");
var content = doc.evaluate('//div[@id="description"]/ul/li', doc, null, XPathResult.ANY_TYPE, null);
var xPathCount = doc.evaluate('count (//div[@id="description"]/ul/li)', doc, null, XPathResult.ANY_TYPE, null);
for (var i=0; i<xPathCount.numberValue; i++) {
contents = content.iterateNext().textContent.split(": ");
if (contents.length>1) {
fieldTitle = contents[0].replace(/\s*/g, '');
dataTags[fieldTitle] = contents[1].replace(/^\s*|\s*$/g, '');
}
}
//Authors
if (doc.evaluate('//h2', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
var authors = doc.evaluate('//h2', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent;
if (authors.match(/\w/)) {
authors = authors.replace(/^\s*by/, "");
multiAuthors = authors.split(";");
for (var j=0; j<multiAuthors.length; j++) {
var aut = multiAuthors[j];
newItem.creators.push(Zotero.Utilities.cleanAuthor(aut, "author", aut.match(/,/)));
}
}
}
//extra
if (dataTags["Quantityavailable"]) {
newItem.extra = "Quantity Available: " + dataTags["Quantityavailable"];
}
associateData (newItem, dataTags, "Publisher", "publisher");
associateData (newItem, dataTags, "Place", "place");
associateData (newItem, dataTags, "Datepublished", "date");
associateData (newItem, dataTags, "ISBN10", "ISBN");
associateData (newItem, dataTags, "ISBN13", "ISBN");
associateData (newItem, dataTags, "Pages", "pages");
associateData (newItem, dataTags, "Edition", "edition");
newItem.title = ZU.xpathText(doc, '//h1').replace(/^\s*|\.\s*$/g, '');
newItem.url = doc.location.href;
newItem.complete();
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//div[@class="row"]//a[@class="sr-title-text"]');
for (var i=0; i<rows.length; i++) {
var href = rows[i].href;
var title = ZU.trimInternal(rows[i].textContent);
var rows = doc.querySelectorAll('h2.title > a[href*="/book/"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
@ -98,23 +61,65 @@ function getSearchResults(doc, checkOnly) {
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (!items) {
return true;
}
var articles = [];
for (var i in items) {
articles.push(i);
}
ZU.processDocuments(articles, scrape);
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
} else {
}
else {
scrape(doc, url);
}
}
function scrape(doc, _url) {
let item = new Zotero.Item('book');
for (let keyElem of doc.querySelectorAll('#d-book-details dt')) {
let key = ZU.trimInternal(keyElem.textContent);
let value = keyElem.nextElementSibling.textContent;
switch (key) {
case 'Title':
item.title = value.replace(/\.\s*$/, '');
break;
case 'Author':
for (let name of value.split(';')) {
item.creators.push(ZU.cleanAuthor(name, 'author', true));
}
break;
case 'Edition':
item.edition = value;
break;
case 'Publisher':
item.publisher = value;
break;
case 'Place of Publication':
item.place = value;
break;
case 'Date published':
case 'First published':
case 'This edition first published':
item.date = ZU.strToISO(value);
break;
case 'ISBN 10':
case 'ISBN 13':
item.ISBN = ZU.cleanISBN(value);
break;
default:
if (!item.date && /\bpublished\b/i.test(key)) {
// handle odd date labels, just in case
item.date = ZU.strToISO(value);
}
break;
}
}
item.url = attr(doc, 'link[rel="canonical"]', 'href');
item.complete();
}
/** BEGIN TEST CASES **/
var testCases = [
{
@ -124,10 +129,11 @@ var testCases = [
},
{
"type": "web",
"url": "http://www.biblio.com/book/through-year-dickens-compiled-his-eldest/d/29965287",
"url": "https://www.biblio.com/book/through-year-dickens-compiled-his-eldest/d/29965287",
"items": [
{
"itemType": "book",
"title": "Through The Year With Dickens. Compiled by his Eldest Daughter",
"creators": [
{
"firstName": "Charles",
@ -135,20 +141,76 @@ var testCases = [
"creatorType": "author"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"publisher": "DeWolfe, Fiske & Co",
"place": "Boston, USA",
"date": "1909",
"edition": "First American",
"title": "Through The Year With Dickens. Compiled by his Eldest Daughter",
"url": "http://www.biblio.com/book/through-year-dickens-compiled-his-eldest/d/29965287",
"libraryCatalog": "Biblio.com",
"accessDate": "CURRENT_TIMESTAMP"
"place": "Boston, USA",
"publisher": "DeWolfe, Fiske & Co",
"url": "https://www.biblio.com/book/through-year-dickens-compiled-his-eldest/d/29965287",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.biblio.com/book/charming-children-dickens-stories-dickens-charles/d/1397028696",
"items": [
{
"itemType": "book",
"title": "Charming Children of Dickens' Stories",
"creators": [
{
"firstName": "Charles",
"lastName": "Dickens",
"creatorType": "author"
},
{
"firstName": "Angela",
"lastName": "Dickens",
"creatorType": "author"
}
],
"date": "1906",
"libraryCatalog": "Biblio.com",
"place": "Chicago",
"publisher": "John A. Hertel Company",
"url": "https://www.biblio.com/book/charming-children-dickens-stories-dickens-charles/d/1397028696",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.biblio.com/book/birds-without-wings-bernieres-louis/d/920369973",
"items": [
{
"itemType": "book",
"title": "Birds Without Wings",
"creators": [
{
"firstName": "LOUIS",
"lastName": "DE BERNIERES",
"creatorType": "author"
}
],
"date": "2005-06-28",
"ISBN": "9781400079322",
"libraryCatalog": "Biblio.com",
"place": "New York",
"publisher": "Vintage",
"url": "https://www.biblio.com/book/birds-without-wings-bernieres-louis/d/920369973",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View File

@ -16,7 +16,7 @@
"inRepository": true,
"translatorType": 3,
"browserSupport": "gcsibv",
"lastUpdated": "2019-09-01 13:38:00"
"lastUpdated": "2022-09-30 10:56:50"
}
var n = {
@ -785,7 +785,15 @@ function getStatementsByDefinition(definition, node) {
function detectImport() {
// look for a bibo item type
var rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null);
let rdfTypes = null;
try {
rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null);
}
catch (err) {
// probably just not RDF
return false;
}
if (rdfTypes) {
for (var i=0; i<rdfTypes.length; i++) {
if (typeof rdfTypes[i][2] === "object" && Z.RDF.getResourceURI(rdfTypes[i][2]).substr(0, BIBO_NS_LENGTH) == n.bibo) return true;
@ -1063,6 +1071,10 @@ function doExport() {
var item;
var items = {};
while (item = Zotero.nextItem()) {
// Skip standalone notes
if (item.itemType == 'note') {
continue;
}
items[item.itemID] = item;
}
var autoTags = {};
@ -1151,4 +1163,4 @@ var testCases = [
]
}
]
/** END TEST CASES **/
/** END TEST CASES **/

View File

@ -126,8 +126,6 @@ function doWeb(doc, url) {
if (prefix == 'x') return namespace; else return null;
} : null;
var articles = new Array();
if (detectWeb(doc, url) == "multiple") {
var items = new Object();
@ -139,13 +137,11 @@ function doWeb(doc, url) {
items[next_title.href] = next_title.textContent;
}
}
items = Zotero.selectItems(items);
for (var i in items) {
articles.push(i);
}
} else {
articles = [url];
Zotero.selectItems(items, function (items) {
ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
Zotero.Utilities.processDocuments(articles, scrape, function() {Zotero.done();});
Zotero.wait();
}

File diff suppressed because it is too large Load Diff

296
Bloomsbury Food Library.js Normal file
View File

@ -0,0 +1,296 @@
{
"translatorID": "0524c89b-2a96-4d81-bb05-ed91ed8b2b47",
"label": "Bloomsbury Food Library",
"creator": "Abe Jellinek",
"target": "^https?://(www\\.)?bloomsburyfoodlibrary\\.com/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-08-03 01:17:12"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (doc.querySelector('a[href*="/getris"]')) {
if (url.includes('bloomsburyfoodlibrary.com/encyclopedia-chapter')) {
if (text(doc, '.subfacet').includes('Book chapter')) {
return 'bookSection';
}
else {
return 'encyclopediaArticle';
}
}
else if (url.includes('bloomsburyfoodlibrary.com/audio')) {
// would like to support these, but the RIS isn't useful
return false;
}
else if (url.includes('bloomsburyfoodlibrary.com/museum')) {
return 'artwork';
}
else {
return 'book';
}
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('a#search-result-link');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var risURL = attr(doc, 'a[href*="/getris"]', 'href');
ZU.doGet(risURL, function (text) {
var translator = Zotero.loadTranslator("import");
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
translator.setString(text);
translator.setHandler("itemDone", function (obj, item) {
let detectedType = detectWeb(doc, url);
if (detectedType == 'encyclopediaArticle' && item.itemType == 'bookSection') {
item.itemType = 'encyclopediaArticle';
item.encyclopediaTitle = item.bookTitle;
delete item.bookTitle;
}
else if (detectedType == 'book' && item.itemType == 'bookSection') {
item.itemType = 'book';
delete item.bookTitle;
// filter out duplicate "editor" names
let names = new Set();
item.creators = item.creators.filter((creator) => {
let fullName = `${creator.lastName}, ${creator.firstName}`;
if (names.has(fullName)) {
return false;
}
names.add(fullName);
return true;
});
}
else if (detectedType == 'artwork') {
item.itemType = 'artwork';
}
for (let prop of ['title', 'bookTitle', 'encyclopediaTitle']) {
if (item[prop]) {
item[prop] = item[prop].replace(/ : /, ': ');
}
}
if (item.publisher) {
item.publisher = item.publisher.replace('©', '');
}
item.archive = '';
// contains full text, if we're on a chapter
item.attachments.push({
title: 'Snapshot',
document: doc
});
item.complete();
});
translator.translate();
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia-chapter?docid=b-9781474208642&tocid=b-9781474208642-000399&pdfid=9781474208642.0008.pdf",
"defer": true,
"items": [
{
"itemType": "encyclopediaArticle",
"title": "Burkina Faso",
"creators": [
{
"lastName": "Debevec",
"firstName": "Liza",
"creatorType": "author"
},
{
"lastName": "Albala",
"firstName": "Ken",
"creatorType": "editor"
}
],
"date": "2011",
"ISBN": "9781474208642",
"edition": "1",
"encyclopediaTitle": "Food Cultures of the World Encyclopedia: Africa and the Middle East",
"language": "en",
"libraryCatalog": "Bloomsbury Food Library",
"pages": "23-30",
"place": "Santa Barbara",
"publisher": "ABC-Clio Inc",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia-chapter?docid=b-9781474208642&tocid=b-9781474208642-000399",
"volume": "1",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia?docid=b-9781474205283",
"items": [
{
"itemType": "book",
"title": "The Agency of Eating: Mediation, Food and the Body",
"creators": [
{
"lastName": "Abbots",
"firstName": "Emma-Jayne",
"creatorType": "author"
}
],
"date": "2017",
"ISBN": "9781474205283",
"edition": "1",
"language": "en",
"libraryCatalog": "Bloomsbury Food Library",
"place": "London",
"publisher": "Bloomsbury Academic",
"series": "Contemporary Food Studies: Economy, Culture and Politics",
"shortTitle": "The Agency of Eating",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia?docid=b-9781474205283",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia?docid=b-9781474203937",
"items": [
{
"itemType": "book",
"title": "Agri-Food and Rural Development: Sustainable Place-Making",
"creators": [
{
"lastName": "Marsden",
"firstName": "Terry",
"creatorType": "author"
}
],
"date": "2017",
"ISBN": "9781474203937",
"edition": "1",
"language": "en",
"libraryCatalog": "Bloomsbury Food Library",
"place": "London",
"publisher": "Bloomsbury Academic",
"series": "Contemporary Food Studies: Economy, Culture and Politics",
"shortTitle": "Agri-Food and Rural Development",
"url": "https://www.bloomsburyfoodlibrary.com/encyclopedia?docid=b-9781474203937",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.bloomsburyfoodlibrary.com/museumobject?docid=TNA_COPY1_241-95",
"defer": true,
"items": [
{
"itemType": "artwork",
"title": "Advert for Hill Evans's barley malt vinegar",
"creators": [],
"libraryCatalog": "Bloomsbury Food Library",
"url": "https://www.bloomsburyfoodlibrary.com/museum?docid=TNA_COPY1_241-95",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.bloomsburyfoodlibrary.com/search-results?any=corn",
"items": "multiple"
}
]
/** END TEST CASES **/

195
Bluesky.js Normal file
View File

@ -0,0 +1,195 @@
{
"translatorID": "3bba003a-ad42-457e-9ea1-547df39d9d00",
"label": "Bluesky",
"creator": "Stephan Hügel",
"target": "^https://bsky\\.app/",
"minVersion": "5.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2025-03-26 14:26:25"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2024 Stephan Hügel <urschrei@gmail.com>
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
let handleRe = /(?:\/profile\/)(([^/]+))/;
let postIdRe = /(?:\/post\/)([a-zA-Z0-9]+)/;
function detectWeb(doc, url) {
if (url.includes('/post/') && handleRe.test(url) && postIdRe.test(url)) {
return 'forumPost';
}
return false;
}
async function doWeb(doc, url) {
await scrapeAPI(doc, url);
}
async function scrapeAPI(doc, url) {
let foundHandle = url.match(handleRe)[1];
let foundPostId = url.match(postIdRe)[1];
let apiUrl = `https://public.api.bsky.app/xrpc/app.bsky.feed.getPostThread?uri=at://${foundHandle}/app.bsky.feed.post/${foundPostId}`;
let data = await ZU.requestJSON(apiUrl);
if (!(data.thread && data.thread.post)) {
throw new Error("Couldn't save post due to missing metadata");
}
else {
let post = data.thread.post;
let item = new Zotero.Item("forumPost");
// Main post details
// remove newlines and extra whitespace
let titleCleaned = post.record.text.replace(/\s+/g, ' ');
// Ensure that full post text is always available
item.abstractNote = titleCleaned;
// Tidy if necessary
if (titleCleaned.length < 140) {
item.title = titleCleaned;
}
else {
item.title = ZU.ellipsize(titleCleaned, 140, true);
}
item.forumTitle = "Bluesky";
item.type = "Post";
item.url = url;
item.date = post.record.createdAt;
// Add author information
if (post.author) {
if (post.author.displayName !== "") {
item.creators.push(Zotero.Utilities.cleanAuthor(post.author.displayName, "author"));
}
else if (post.author.handle !== "handle.invalid") {
item.creators.push(Zotero.Utilities.cleanAuthor(post.author.handle, "author"));
}
// we've got a blank display name and an invalid handle, so we can't add an author: bail out
else {
throw new Error("Couldn't save post due to missing author data: neither display name nor handle are available");
}
if (post.author.handle !== "handle.invalid") {
item.setExtra("Author Handle", post.author.handle);
}
// DID is the creator's unique id in the ATProto network
item.setExtra("DID", post.author.did);
}
// Add metadata for likes, reposts, etc.
item.setExtra("Likes", post.likeCount);
item.setExtra("Reposts", post.repostCount);
item.setExtra("Quotes", post.quoteCount);
// Handle embedded quote records (if any)
if (post.embed && post.embed.record && post.embed.record.value) {
let embeddedPost = post.embed.record.value;
item.notes.push({ note: `This post is quoting a post by @${post.embed.record.author.handle}: "${embeddedPost.text}"` });
}
// Handle replies (if any)
if (data.thread.replies && data.thread.replies.length > 0) {
item.notes.push({ note: `This post had ${data.thread.replies.length} direct replies when it was saved` });
}
item.attachments.push({ document: doc, title: "Snapshot" });
item.complete();
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://bsky.app/profile/watershedlab.bsky.social/post/3lcl3glmdx226",
"defer": true,
"items": [
{
"itemType": "forumPost",
"title": "My first and only job in media was as a reporter on a small newspaper in England in 2002. My salary was £8700. Per year.",
"creators": [
{
"firstName": "Dan",
"lastName": "Shugar",
"creatorType": "author"
}
],
"date": "2024-12-05T16:25:35.749Z",
"abstractNote": "My first and only job in media was as a reporter on a small newspaper in England in 2002. My salary was £8700. Per year.",
"extra": "Author Handle: watershedlab.bsky.social\nDID: did:plc:ufufhaxc74cfl7fpjccykkyh\nLikes: 8\nReposts: 0\nQuotes: 0",
"forumTitle": "Bluesky",
"postType": "Post",
"url": "https://bsky.app/profile/watershedlab.bsky.social/post/3lcl3glmdx226",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [
{
"note": "This post is quoting a post by @ericwickham.ca: \"Told the guy replacing my car window how much I made at my first job in radio and I feel like it deeply changed what he thought about people in media.\""
},
{
"note": "This post had 1 direct replies when it was saved"
}
],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://bsky.app/profile/did:plc:cxq4zxu7soi67juyvxml46zs/post/3ldr6ebdz5c24",
"defer": true,
"items": [
{
"itemType": "forumPost",
"title": "💚 Site of the Day - Rain Delay Media Love that menu! ⚙️ SplitText 🛠️ Webflow site → raindelaymedia.com showcase → gsap.com/showcase",
"creators": [
{
"firstName": "",
"lastName": "GSAP",
"creatorType": "author"
}
],
"date": "2024-12-20T19:59:08.958Z",
"abstractNote": "💚 Site of the Day - Rain Delay Media Love that menu! ⚙️ SplitText 🛠️ Webflow site → raindelaymedia.com showcase → gsap.com/showcase",
"extra": "Author Handle: gsap-greensock.bsky.social\nDID: did:plc:cxq4zxu7soi67juyvxml46zs\nLikes: 6\nReposts: 0\nQuotes: 0",
"forumTitle": "Bluesky",
"postType": "Post",
"url": "https://bsky.app/profile/did:plc:cxq4zxu7soi67juyvxml46zs/post/3ldr6ebdz5c24",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

129
BnF ISBN.js Normal file
View File

@ -0,0 +1,129 @@
{
"translatorID": "f349954c-9957-4b5f-be24-1a8bb52f7fbd",
"label": "BnF ISBN",
"creator": "Abe Jellinek",
"target": "",
"minVersion": "4.0",
"maxVersion": "",
"priority": 98,
"inRepository": true,
"translatorType": 8,
"browserSupport": "gcsibv",
"lastUpdated": "2021-07-30 21:23:00"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
let ns = {
srw: 'http://www.loc.gov/zing/srw/',
mxc: 'info:lc/xmlns/marcxchange-v2'
};
function detectSearch(item) {
return !!item.ISBN;
}
function doSearch(item) {
let ISBN = ZU.cleanISBN(item.ISBN);
let url = `https://catalogue.bnf.fr/api/SRU?version=1.2&operation=searchRetrieve&query=bib.isbn%20all%20%22${ISBN}%22`;
ZU.doGet(url, function (xmlText) {
let parser = new DOMParser();
let xml = parser.parseFromString(xmlText, 'application/xml');
let records = ZU.xpath(xml.documentElement, '/srw:searchRetrieveResponse/srw:records/srw:record', ns);
if (!records) return;
for (let record of records) {
if (ZU.xpathText(record, '//srw:recordSchema', ns) != 'marcxchange') continue;
let marcRecords = ZU.xpath(record, '//srw:recordData/mxc:record', ns);
if (!marcRecords) continue;
for (let marcRecord of marcRecords) {
marcRecord.setAttribute('xmlns:marc', 'http://www.loc.gov/MARC21/slim');
// Here we convert the XML we get from BnF from the original
// MarcXchange format into MARCXML by search-and-replacing
// the namespace. MARCXML and and MarcXchange are essentially
// the same format: the latter is a "generalization (mainly by
// weakening restrictions)" of the former. We didn't enforce
// those restrictions to begin with.
// MarcXchange spec:
// https://www.loc.gov/standards/iso25577/ISO_DIS_25577__E_.pdf
let marcxchangeText = new XMLSerializer().serializeToString(marcRecord);
let marcXMLText = marcxchangeText.replace(/<mxc:/g, '<marc:').replace(/<\/mxc:/g, '</marc:');
let translator = Zotero.loadTranslator('import');
// MARCXML
translator.setTranslator('edd87d07-9194-42f8-b2ad-997c4c7deefd');
translator.setString(marcXMLText);
translator.translate();
}
}
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "search",
"input": {
"ISBN": "9781841692203"
},
"items": [
{
"itemType": "book",
"creators": [
{
"lastName": "Markus",
"firstName": "Keith A.",
"creatorType": "author"
},
{
"lastName": "Borsboom",
"creatorType": "author",
"firstName": "Denny"
}
],
"notes": [],
"tags": [],
"seeAlso": [],
"attachments": [],
"libraryCatalog": "BnF ISBN",
"place": "New York",
"ISBN": "9781841692203",
"title": "Frontiers in test validity theory: measurement, causation and meaning",
"publisher": "Routledge",
"date": "2013",
"language": "eng",
"shortTitle": "Frontiers in test validity theory",
"series": "Multivariate applications series",
"callNumber": "150.287"
}
]
}
]
/** END TEST CASES **/

View File

@ -8,8 +8,7 @@
"priority": 100,
"inRepository": true,
"translatorType": 3,
"browserSupport": "gcsibv",
"lastUpdated": "2017-12-17 17:43:00"
"lastUpdated": "2022-07-14 20:21:20"
}
/*
@ -234,13 +233,18 @@ function doExport() {
'<H1>Bookmarks Menu</H1>\n'+
'<DL>\n';
var footer = '</DL>';
//var tags = "";
Zotero.write(header);
while (item = Zotero.nextItem()) {
// TODO Be more verbose, making an informative title and including more metadata
//tags = item.tags.forEach(function (tag) {return tag.tag}).join(",");
if (item.url) Zotero.write(' <DT><A HREF="'+item.url+'">'+item.title+'</A>\n');
let tags = item.tags.map(tag => tag.tag).join(',');
if (item.url) {
Zotero.write(' <DT><A HREF="'+item.url+'"');
if (tags) {
Zotero.write(' TAGS="' + tags + '"');
}
Zotero.write('>'+item.title+'</A>\n');
}
else Zotero.debug("Skipping item without URL: "+item.title);
}
Zotero.write(footer);

223
Bookshop.org.js Normal file
View File

@ -0,0 +1,223 @@
{
"translatorID": "05997944-d1c2-41bf-a399-9932268c81e5",
"label": "Bookshop.org",
"creator": "Abe Jellinek",
"target": "^https://bookshop\\.org/books",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2021-07-01 17:14:32"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2021 Abe Jellinek
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (/\/books\/[^/]+\/[0-9]+/.test(url)
&& attr('meta[property="og:type"]', 'content') == 'book') {
return "book";
}
else if (getSearchResults(doc, true)) {
return "multiple";
}
return false;
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = doc.querySelectorAll('h2 a[href*="/books/"]');
for (let row of rows) {
let href = row.href;
let title = ZU.trimInternal(row.textContent);
if (!href || !title) continue;
if (checkOnly) return true;
found = true;
items[href] = title;
}
return found ? items : false;
}
function doWeb(doc, url) {
if (detectWeb(doc, url) == "multiple") {
Zotero.selectItems(getSearchResults(doc, false), function (items) {
if (items) ZU.processDocuments(Object.keys(items), scrape);
});
}
else {
scrape(doc, url);
}
}
function scrape(doc, url) {
var translator = Zotero.loadTranslator('web');
// Embedded Metadata
translator.setTranslator('951c027d-74ac-47d4-a107-9c3069ab7b48');
translator.setDocument(doc);
translator.setHandler('itemDone', function (obj, item) {
item.numPages = text(doc, '[itemprop="numberOfPages"]');
item.publisher = text(doc, '[itemprop="publisher"]');
item.tags = [];
item.attachments = [];
item.url = '';
for (let author of doc.querySelectorAll('span[itemprop="author"]')) {
let name = text(author, 'span[itemprop="name"]');
let type = author.parentNode.nextSibling.textContent;
if (type.includes('Author')) {
type = 'author';
}
else if (type.includes('Editor')) {
type = 'editor';
}
else if (type.includes('Translator')) {
type = 'translator';
}
else {
type = 'contributor';
}
item.creators.push(ZU.cleanAuthor(name, type));
}
item.complete();
});
translator.getTranslatorObject(function (trans) {
trans.itemType = "book";
trans.doWeb(doc, url);
});
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "https://bookshop.org/books/crying-in-h-mart-a-memoir/9780525657743",
"items": [
{
"itemType": "book",
"title": "Crying in H Mart: A Memoir",
"creators": [
{
"firstName": "Michelle",
"lastName": "Zauner",
"creatorType": "author"
}
],
"date": "2021-04-20T12:00:00-04:00",
"ISBN": "9780525657743",
"abstractNote": "NEW YORK TIMES BEST SELLER - A Best Book of 2021: AV Club - Bustle - Entertainment Weekly - Good Morning America - Chicago Review of Books - Fortune - TIME - CNN Underscored - Apartment Therapy - Popsugar - Hello Giggles - Business Insider - The Millions - Wall Street Journal Magazine - Glamour From the indie rockstar of Japanese Breakfast fame, and author of the viral 2018 New Yorker essay that shares the title of this book, an unflinching, powerful memoir about growing up Korean American, losing her mother, and forging her own identity. In this exquisite story of family, food, grief, and endurance, Michelle Zauner proves herself far more than a dazzling singer, songwriter, and guitarist. With humor and heart, she tells of growing up one of the few Asian American kids at her school in Eugene, Oregon; of struggling with her mother's particular, high expectations of her; of a painful adolescence; of treasured months spent in her grandmother's tiny apartment in Seoul, where she and her mother would bond, late at night, over heaping plates of food. As she grew up, moving to the East Coast for college, finding work in the restaurant industry, and performing gigs with her fledgling band--and meeting the man who would become her husband--her Koreanness began to feel ever more distant, even as she found the life she wanted to live. It was her mother's diagnosis of terminal cancer, when Michelle was twenty-five, that forced a reckoning with her identity and brought her to reclaim the gifts of taste, language, and history her mother had given her. Vivacious and plainspoken, lyrical and honest, Zauner's voice is as radiantly alive on the page as it is onstage. Rich with intimate anecdotes that will resonate widely, and complete with family photos, Crying in H Mart is a book to cherish, share, and reread.",
"language": "en",
"libraryCatalog": "bookshop.org",
"numPages": "256",
"publisher": "Knopf Publishing Group",
"shortTitle": "Crying in H Mart",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://bookshop.org/books/organic-chemistry-for-babies/9781492671169",
"items": [
{
"itemType": "book",
"title": "Organic Chemistry for Babies",
"creators": [
{
"firstName": "Chris",
"lastName": "Ferrie",
"creatorType": "author"
},
{
"firstName": "Cara",
"lastName": "Florance",
"creatorType": "author"
}
],
"date": "2018-05-01T12:00:00-04:00",
"ISBN": "9781492671169",
"abstractNote": "Fans of Chris Ferrie's Rocket Science for Babies, Quantum Physics for Babies, and 8 Little Planets will love this introduction to organic chemistry for babies and toddlers!It only takes a small spark to ignite a child's mind.Written by an expert, Organic Chemistry for Babies is a colorfully simple introduction to the structure of organic, carbon-containing compounds and materials. Gift your special little one the opportunity to learn with this perfect science baby gift and help them be one step ahead of pre-med students! With a tongue-in-cheek approach that adults will love, this installment of the Baby University baby board book series is the perfect way to introduce STEM concepts for babies and toddlers. After all, it's never too early to become an organic chemist!If you're looking for the perfect STEAM book for teachers, science toys for babies, or chemistry toys for kids, look no further! Organic Chemistry for Babies offers fun early learning for your little scientist!",
"language": "en",
"libraryCatalog": "bookshop.org",
"numPages": "24",
"publisher": "Sourcebooks Explore",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://bookshop.org/books?keywords=pippi",
"items": "multiple"
},
{
"type": "web",
"url": "https://bookshop.org/books/meditations-a-new-translation-7be5ded9-87a9-4056-af72-d6c917125a29/9780812968255",
"items": [
{
"itemType": "book",
"title": "Meditations: A New Translation",
"creators": [
{
"firstName": "Marcus",
"lastName": "Aurelius",
"creatorType": "author"
},
{
"firstName": "Gregory",
"lastName": "Hays",
"creatorType": "translator"
}
],
"date": "2003-05-06T12:00:00-04:00",
"ISBN": "9780812968255",
"abstractNote": "Nearly two thousand years after it was written, Meditations remains profoundly relevant for anyone seeking to lead a meaningful life. Few ancient works have been as influential as the Meditations of Marcus Aurelius, philosopher and emperor of Rome (A.D. 161-180). A series of spiritual exercises filled with wisdom, practical guidance, and profound understanding of human behavior, it remains one of the greatest works of spiritual and ethical reflection ever written. Marcus's insights and advice--on everything from living in the world to coping with adversity and interacting with others--have made the Meditations required reading for statesmen and philosophers alike, while generations of ordinary readers have responded to the straightforward intimacy of his style. For anyone who struggles to reconcile the demands of leadership with a concern for personal integrity and spiritual well-being, the Meditations remains as relevant now as it was two thousand years ago. In Gregory Hays's new translation--the first in thirty-five years--Marcus's thoughts speak with a new immediacy. In fresh and unencumbered English, Hays vividly conveys the spareness and compression of the original Greek text. Never before have Marcus's insights been so directly and powerfully presented. With an Introduction that outlines Marcus's life and career, the essentials of Stoic doctrine, the style and construction of the Meditations, and the work's ongoing influence, this edition makes it possible to fully rediscover the thoughts of one of the most enlightened and intelligent leaders of any era.",
"language": "en",
"libraryCatalog": "bookshop.org",
"numPages": "256",
"publisher": "Modern Library",
"shortTitle": "Meditations",
"attachments": [],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

Some files were not shown because too many files have changed in this diff Show More