summaryrefslogtreecommitdiff
path: root/DTU Orbit.js
blob: b3c3abf134a06aa9d512eeb4572f9f54f485a648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{
	"translatorID": "097c963e-3866-4c6f-a6b4-f5e9d0d15530",
	"label": "DTU Orbit",
	"creator": "Sebastian Karcher",
	"target": "^https?://orbit\\.dtu\\.dk/",
	"minVersion": "3.0",
	"maxVersion": "",
	"priority": 100,
	"inRepository": true,
	"translatorType": 4,
	"browserSupport": "gcbv",
	"lastUpdated": "2013-05-15 20:05:47"
}

/*
	***** BEGIN LICENSE BLOCK *****
	
	Copyright © 2013 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.search(/publications\/search\.html/)!=-1) return "multiple";
	else if (url.search(/\/publications\/.+\.html/)!=-1) return "journalArticle";
	return false;
}
	

function doWeb(doc, url){

	var articles = new Array();
	if(detectWeb(doc, url) == "multiple") { 
		var items = {};
		var titles = doc.evaluate('//li[@class="portal_list_item"]/div//a[contains(@href, "/publications/")]', doc, null, XPathResult.ANY_TYPE, null);
		var title;
		while (title = titles.iterateNext()) {
			items[title.href] = title.textContent;
		}
		Zotero.selectItems(items, function (items) {
			if (!items) {
				return true;
			}
			for (var i in items) {
				articles.push(i);
			}
			Zotero.Utilities.processDocuments(articles, scrape)
		});
	} else {
		scrape(doc, url);
	}
}

function scrape(doc, url){
	var pdfurl = ZU.xpathText(doc, '//ul[@class="relations documents"]//a[contains(@href, ".pdf")]/@href');
	//also work on citatin page
	var risurl = url.replace(/(\/export)?\.html/,"/export.html");
	ZU.processDocuments(risurl, function (doc) {	
		//assemble RIS line by line
		rislines = ZU.xpath(doc, '//div[@class="view_container"]/div[contains(@class, "_ris")]/p')
		var risarray = [];
		for(i in rislines){
			risarray.push(rislines[i].textContent)
		}
		var ris = risarray.join("\n");
		//Zotero.debug(ris)
		var translator = Zotero.loadTranslator("import");
		translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
		translator.setString(ris);
		translator.setHandler("itemDone", function(obj, item) {
			if (pdfurl)	item.attachments = [{url:pdfurl, title: "DTU Orbit - Full Text PDF", mimeType: "application/pdf"}];
			item.complete();
		});	
		translator.translate();
	});
}
/** BEGIN TEST CASES **/
var testCases = [
	{
		"type": "web",
		"url": "http://orbit.dtu.dk/en/publications/nonlinear-wave-equation-in-frequency-domain-accurate-modeling-of-ultrafast-interaction-in-anisotropic-nonlinear-media(726e7daf-08e1-44c5-9e4f-6e98e8fa1b12).html",
		"items": [
			{
				"itemType": "journalArticle",
				"creators": [
					{
						"lastName": "Guo",
						"firstName": "Hairun",
						"creatorType": "author"
					},
					{
						"lastName": "Zeng",
						"firstName": "Xianglong",
						"creatorType": "author"
					},
					{
						"lastName": "Zhou",
						"firstName": "Binbin",
						"creatorType": "author"
					},
					{
						"lastName": "Bache",
						"firstName": "Morten",
						"creatorType": "author"
					},
					{
						"lastName": "Guo",
						"firstName": "Hairun",
						"creatorType": "author"
					},
					{
						"lastName": "Zeng",
						"firstName": "Xianglong",
						"creatorType": "author"
					},
					{
						"lastName": "Zhou",
						"firstName": "Binbin",
						"creatorType": "author"
					},
					{
						"lastName": "Bache",
						"firstName": "Morten",
						"creatorType": "author"
					}
				],
				"notes": [],
				"tags": [],
				"seeAlso": [],
				"attachments": [
					{
						"title": "DTU Orbit - Full Text PDF",
						"mimeType": "application/pdf"
					}
				],
				"title": "Nonlinear wave equation in frequency domain: accurate modeling of ultrafast interaction in anisotropic nonlinear media",
				"publisher": "Optical Society of America",
				"date": "March 1, 2013",
				"abstractNote": "We interpret the purely spectral forward Maxwell equation with up to third-order induced polarizations for pulse propagation and interactions in quadratic nonlinear crystals. The interpreted equation, also named the nonlinear wave equation in the frequency domain, includes quadratic and cubic nonlinearities, delayed Raman effects, and anisotropic nonlinearities. The full potential of this wave equation is demonstrated by investigating simulations of solitons generated in the process of ultrafast cascaded second-harmonic generation. We show that a balance in the soliton delay can be achieved due to competition between self-steepening, Raman effects, and self-steepening-like effects from cascading originating in the group-velocity mismatch between the pump and the second harmonic. We analyze the first-order contributions, and show that this balance can be broken to create fast or slow pulses. Through further simulations we demonstrate few-cycle compressed solitons in extremely short crystals, where spectral phenomena, such as blue/red shifting, nonstationary radiation in accordance with the nonlocal phase-matching condition, and dispersive-wave generation are observed and marked, which helps improve the experimental knowledge of cascading nonlinear soliton pulse compression.",
				"DOI": "10.1364/JOSAB.30.000494",
				"journalAbbreviation": "Optical Society of America. Journal B: Optical Physics",
				"publicationTitle": "Optical Society of America. Journal B: Optical Physics",
				"ISSN": "0740-3224",
				"issue": "3",
				"volume": "30",
				"pages": "494-504",
				"libraryCatalog": "DTU Orbit",
				"shortTitle": "Nonlinear wave equation in frequency domain"
			}
		]
	},
	{
		"type": "web",
		"url": "http://orbit.dtu.dk/en/publications/search.html?search=labor&uri=&advanced=true&institution=all&organisationName=&organisations=&type=&publicationstatus=&publicationcategory=&peerreview=&publicationYearsFrom=&publicationYearsTo=&submissionYearsFrom=&submissionYearsTo=",
		"items": "multiple"
	}
]
/** END TEST CASES **/