{ "translatorID": "5f0ca39b-898a-4b1e-b98d-8cd0d6ce9801", "label": "Airiti", "creator": "Aurimas Vinckevicius", "target": "^https?://([^/]+\\.)?airitilibrary\\.com/Publication/alDetailedMesh", "minVersion": "3.0", "maxVersion": "", "priority": 110, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2023-08-04 05:04:16" } function detectWeb(doc, url) { // How can we distinguish thesis from journal article?? if (ZU.xpathText(doc, '/html/head/meta[@name="citation_title"]/@content')) { return 'journalArticle'; } } function getDocId(url) { var m = url.match(/\bDocID=([^&#]+)/i); if (!m) return; return m[1]; } async function doWeb(doc, url) { var docID = getDocId(url); await scrape([docID], function(item) { if (!item.url) { // Maybe we shouldn't. Looks more like a catalog. item.url = url; } item.attachments.push({ title: 'Snapshot', document: doc }); item.complete(); }); } async function scrape(docIDs, itemDoneHandler) { let tokenParams = new URLSearchParams(); tokenParams.append('BER', JSON.stringify(docIDs.map(id => ({ DocID: id, IsCanAddShoppingCar: null })))); tokenParams.append('IsShowLink', 'false'); tokenParams.append('keepThis', 'true'); // This sets the necessary cookies: await requestDocument('https://www.airitilibrary.com/Publication/MetaExport?' + tokenParams); var bibTeXUrl = buildQuery(docIDs); ZU.doGet(bibTeXUrl, function(text) { var translator = Zotero.loadTranslator("import"); // BibTeX translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); translator.setString(text); translator.setHandler('itemDone', function(obj, item) { // Chinese names are not split correctly // Sometimes, English name is provided as well in parentheses for (var i=0, n=item.creators.length; i 1) { c.firstName = name.substr(1, name.length); } else { delete c.firstName; c.fieldMode = 1; } } // language is sometimes written in chinese // use "zh", since I think dialect actually varies in this catalog item.language = "zh"; // search- and web-specific itemDone handlers if (itemDoneHandler) itemDoneHandler(item); else item.complete(); }); translator.translate(); }); } function buildQuery(docIDs) { var url = 'https://www.airitilibrary.com/publication/ExportTo?ExportType=BibTex' + '¶meter=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16'; for (var i=0; i