1
+ {
2
+ "translatorID" : "72dbad15-cd1a-4d52-b2ed-7d67f909cada" ,
3
+ "label" : "The Met" ,
4
+ "creator" : "Aurimas Vinckevicius" ,
5
+ "target" : "^https?://metmuseum\\.org/collection/the-collection-online/search" ,
6
+ "minVersion" : "3.0" ,
7
+ "maxVersion" : "" ,
8
+ "priority" : 100 ,
9
+ "inRepository" : true ,
10
+ "translatorType" : 4 ,
11
+ "browserSupport" : "gcsib" ,
12
+ "lastUpdated" : "2014-07-09 01:41:36"
13
+ }
14
+
15
+ function detectWeb ( doc , url ) {
16
+ if ( doc . getElementsByClassName ( 'tombstone' ) [ 0 ] ) return 'artwork' ;
17
+
18
+ if ( getSearchResults ( doc ) ) return 'multiple' ;
19
+ }
20
+
21
+ function getSearchResults ( doc ) {
22
+ var titles = doc . getElementsByClassName ( 'objtitle' ) ;
23
+
24
+ var items = { } , found = false ;
25
+ for ( var i = 0 ; i < titles . length ; i ++ ) {
26
+ var a = titles [ i ] . parentNode ;
27
+ if ( ! a || ! a . href ) continue ;
28
+
29
+ found = true ;
30
+ items [ a . href ] = ZU . trimInternal ( titles [ i ] . textContent ) ;
31
+ }
32
+
33
+ return found ? items : false ;
34
+ }
35
+
36
+ function doWeb ( doc , url ) {
37
+ if ( detectWeb ( doc , url ) == 'multiple' ) {
38
+ var items = getSearchResults ( doc ) ;
39
+ Z . selectItems ( items , function ( items ) {
40
+ if ( ! items ) return true ;
41
+
42
+ var urls = [ ] ;
43
+ for ( var i in items ) {
44
+ urls . push ( i ) ;
45
+ }
46
+ ZU . processDocuments ( urls , scrape ) ;
47
+ } ) ;
48
+ } else {
49
+ scrape ( doc , url ) ;
50
+ }
51
+ }
52
+
53
+ function scrape ( doc , url ) {
54
+ var item = new Zotero . Item ( 'artwork' ) ;
55
+ var tmbstCont = doc . getElementsByClassName ( 'tombstone-container' ) [ 0 ] ;
56
+ item . title = ZU . trimInternal ( tmbstCont . getElementsByTagName ( 'h2' ) [ 0 ] . textContent ) ;
57
+
58
+ var creator = tmbstCont . getElementsByTagName ( 'h3' ) [ 0 ] ;
59
+ if ( creator ) {
60
+ item . creators . push ( ZU . cleanAuthor (
61
+ ZU . trimInternal ( creator . firstChild . textContent ) ,
62
+ 'author' ,
63
+ false
64
+ ) ) ;
65
+ }
66
+
67
+ var meta = doc . getElementsByClassName ( 'tombstone' ) [ 0 ] . firstElementChild ;
68
+
69
+ do {
70
+ var heading = ZU . trimInternal ( meta . getElementsByTagName ( 'strong' ) [ 0 ] . textContent ) ;
71
+ heading = heading . toLowerCase ( ) . substr ( 0 , heading . length - 1 ) ;
72
+ var content = ZU . trimInternal ( meta . lastChild . textContent ) ;
73
+ switch ( heading ) {
74
+ case 'date' :
75
+ case 'medium' :
76
+ item [ heading ] = content ;
77
+ break ;
78
+ case 'dimensions' :
79
+ item . artworkSize = content ;
80
+ break ;
81
+ case 'accession number' :
82
+ item . callNumber = content ;
83
+ break ;
84
+ case 'classification' :
85
+ case 'period' :
86
+ case 'culture' :
87
+ item . tags . push ( content ) ;
88
+ break ;
89
+ }
90
+ } while ( meta = meta . nextElementSibling ) ;
91
+
92
+ var desc = doc . getElementById ( 'gallery-label' ) ;
93
+ if ( desc ) {
94
+ item . abstractNote = ZU . trimInternal ( desc . textContent ) ;
95
+ }
96
+ item . libraryCatalog = 'The Metropolitan Museum of Art' ;
97
+ item . url = doc . getElementsByClassName ( 'permalink' ) [ 0 ] . href ;
98
+
99
+ var download = doc . getElementsByClassName ( 'download' ) [ 0 ] ;
100
+ if ( download ) {
101
+ item . attachments . push ( {
102
+ title : 'Met Image' ,
103
+ url : download . href
104
+ } ) ;
105
+ }
106
+ item . attachments . push ( {
107
+ title : 'Snapshot' ,
108
+ document : doc
109
+ } ) ;
110
+
111
+ item . complete ( ) ;
112
+ } /** BEGIN TEST CASES **/
113
+ var testCases = [
114
+ {
115
+ "type" : "web" ,
116
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/328877?rpp=30&pg=1&rndkey=20140708&ft=*&who=Babylonian&pos=4" ,
117
+ "items" : [
118
+ {
119
+ "itemType" : "artwork" ,
120
+ "title" : "Cuneiform tablet case impressed with four cylinder seals, for cuneiform tablet 86.11.214a: field rental" ,
121
+ "creators" : [ ] ,
122
+ "date" : "ca. 1749–1712 B.C." ,
123
+ "artworkMedium" : "Clay" ,
124
+ "artworkSize" : "2.1 x 4.4 x 2.9 cm (7/8 x 1 3/4 x 1 1/8 in.)" ,
125
+ "callNumber" : "86.11.214b" ,
126
+ "libraryCatalog" : "The Metropolitan Museum of Art" ,
127
+ "shortTitle" : "Cuneiform tablet case impressed with four cylinder seals, for cuneiform tablet 86.11.214a" ,
128
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/328877" ,
129
+ "attachments" : [
130
+ {
131
+ "title" : "Met Image"
132
+ } ,
133
+ {
134
+ "title" : "Snapshot"
135
+ }
136
+ ] ,
137
+ "tags" : [
138
+ "Babylonian" ,
139
+ "Clay-Tablets-Inscribed-Seal Impressions" ,
140
+ "Old Babylonian"
141
+ ] ,
142
+ "notes" : [ ] ,
143
+ "seeAlso" : [ ]
144
+ }
145
+ ]
146
+ } ,
147
+ {
148
+ "type" : "web" ,
149
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/328877" ,
150
+ "items" : [
151
+ {
152
+ "itemType" : "artwork" ,
153
+ "title" : "Cuneiform tablet case impressed with four cylinder seals, for cuneiform tablet 86.11.214a: field rental" ,
154
+ "creators" : [ ] ,
155
+ "date" : "ca. 1749–1712 B.C." ,
156
+ "artworkMedium" : "Clay" ,
157
+ "artworkSize" : "2.1 x 4.4 x 2.9 cm (7/8 x 1 3/4 x 1 1/8 in.)" ,
158
+ "callNumber" : "86.11.214b" ,
159
+ "libraryCatalog" : "The Metropolitan Museum of Art" ,
160
+ "shortTitle" : "Cuneiform tablet case impressed with four cylinder seals, for cuneiform tablet 86.11.214a" ,
161
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/328877" ,
162
+ "attachments" : [
163
+ {
164
+ "title" : "Met Image"
165
+ } ,
166
+ {
167
+ "title" : "Snapshot"
168
+ }
169
+ ] ,
170
+ "tags" : [
171
+ "Babylonian" ,
172
+ "Clay-Tablets-Inscribed-Seal Impressions" ,
173
+ "Old Babylonian"
174
+ ] ,
175
+ "notes" : [ ] ,
176
+ "seeAlso" : [ ]
177
+ }
178
+ ]
179
+ } ,
180
+ {
181
+ "type" : "web" ,
182
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/436243?rpp=30&pg=1&ft=albrecht+d%c3%bcrer&pos=1" ,
183
+ "items" : [
184
+ {
185
+ "itemType" : "artwork" ,
186
+ "title" : "Salvator Mundi" ,
187
+ "creators" : [
188
+ {
189
+ "firstName" : "Albrecht" ,
190
+ "lastName" : "Dürer" ,
191
+ "creatorType" : "author"
192
+ }
193
+ ] ,
194
+ "date" : "ca. 1505" ,
195
+ "abstractNote" : "This picture of Christ as Salvator Mundi, Savior of the World, who raises his right hand in blessing and in his left holds a globe representing the earth, can be appreciated both as a painting and as a drawing. Albrecht Dürer, the premier artist of the German Renaissance, probably began this work shortly before he departed for Italy in 1505, but completed only the drapery. His unusually extensive and meticulous preparatory drawing on the panel is visible in the unfinished portions of Christ's face and hands." ,
196
+ "artworkMedium" : "Oil on wood" ,
197
+ "artworkSize" : "22 7/8 x 18 1/2in. (58.1 x 47cm)" ,
198
+ "callNumber" : "32.100.64" ,
199
+ "libraryCatalog" : "The Metropolitan Museum of Art" ,
200
+ "url" : "http://metmuseum.org/collection/the-collection-online/search/436243" ,
201
+ "attachments" : [
202
+ {
203
+ "title" : "Met Image"
204
+ } ,
205
+ {
206
+ "title" : "Snapshot"
207
+ }
208
+ ] ,
209
+ "tags" : [
210
+ "Paintings"
211
+ ] ,
212
+ "notes" : [ ] ,
213
+ "seeAlso" : [ ]
214
+ }
215
+ ]
216
+ } ,
217
+ {
218
+ "type" : "web" ,
219
+ "url" : "http://metmuseum.org/collection/the-collection-online/search?ft=albrecht+d%C3%BCrer&noqs=true" ,
220
+ "items" : "multiple"
221
+ }
222
+ ]
223
+ /** END TEST CASES **/
0 commit comments