Skip to content

Commit

Permalink
Merge pull request #243 from jiaojiaodubai/MagTech
Browse files Browse the repository at this point in the history
fix (MagTech.js) 修复人名意外分割,支持更多网站 (closed #241)
  • Loading branch information
l0o0 authored Dec 11, 2023
2 parents 4a76da1 + 89ee71a commit 3223150
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MagTech.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-10-24 08:52:33"
"lastUpdated": "2023-12-01 08:08:32"
}

/*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 3223150

Please sign in to comment.