From 89ee71a826932648060f327b7fa2e125d9f19ace Mon Sep 17 00:00:00 2001 From: jiaojiaodubai <63148861+jiaojiaodubai@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=BA=E5=90=8D=E6=84=8F?= =?UTF-8?q?=E5=A4=96=E5=88=86=E5=89=B2=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E7=BD=91=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MagTech.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MagTech.js b/MagTech.js index 7f349c3d..1f43f65b 100644 --- a/MagTech.js +++ b/MagTech.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2023-10-24 08:52:33" + "lastUpdated": "2023-12-01 08:08:32" } /* @@ -255,9 +255,10 @@ const TAGMAP = { }; function isItem(doc) { - var insite = doc.querySelector('a[href^="http://www.magtech.com"]'); - var havetitle = (new Metas(doc)).getMeta(METAMAP.title); - if (havetitle && insite) { + let insite = doc.querySelector('a[href^="http://www.magtech.com"]'); + let havetitle = (new Metas(doc)).getMeta(METAMAP.title); + let like = doc.querySelector('[class*="magtech"]'); + if (havetitle && (insite || like)) { return { name: 'Unknown-type', issingle: true @@ -317,6 +318,7 @@ function getSearchResults(doc, type, checkOnly) { async function doWeb(doc, url) { var type = WEBTYPE.find(element => (doc.querySelector(element.pagekey))); + if (!type) type = isItem(doc); if (detectWeb(doc, url) == 'multiple') { let items = await Zotero.selectItems(getSearchResults(doc, type, false)); if (!items) return; @@ -367,10 +369,11 @@ function cleanKeywordsStr(keywords) { } function str2arr(string) { - return string.split(/[(,\s?)|,]/); + return string.split(/[,;,;]\s?/); } async function scrape(doc, type, url = doc.location.href) { + // Z.debug(type); var metas = new Metas(doc); var newItem = new Z.Item('journalArticle'); var language = [