9
9
"inRepository" : true ,
10
10
"translatorType" : 4 ,
11
11
"browserSupport" : "gcsibv" ,
12
- "lastUpdated" : "2018-10-08 14:15:17 "
12
+ "lastUpdated" : "2018-10-12 23:37:03 "
13
13
}
14
14
15
15
/*
32
32
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
33
33
34
34
***** END LICENSE BLOCK *****
35
- */
35
+ */
36
36
// URLs
37
37
// trial: div=t18000115-12
38
38
// session: name=16900430
@@ -46,7 +46,7 @@ function detectWeb(doc, url) {
46
46
return "case" ;
47
47
} else if ( url . includes ( "search.jsp" ) && getSearchResults ( doc , true ) ) {
48
48
return "multiple" ;
49
- }
49
+ }
50
50
}
51
51
52
52
// to do: not trials...
@@ -91,20 +91,25 @@ if (url.includes('browse.jsp') && ( url.includes('div=OA') || url.includes('nam
91
91
92
92
var sessDate = ZU . xpathText ( doc , '//div[@class="sessionsPaper"]/div[@class="sessions-paper-date"]' ) ; // add session date, as the date is now in a gettable node
93
93
94
- newItem . date = ZU . strToISO ( sessDate ) ;
94
+ newItem . date = ZU . strToISO ( sessDate ) ;
95
95
96
96
if ( newItem . itemType == "case" && trialTitle && trialTitle == trialTitle . toUpperCase ( ) ) {
97
97
newItem . title = ZU . capitalizeTitle ( trialTitle , true ) ; // todo tidying this up - sometimes no name, messy punctuation
98
98
} else if ( newItem . itemType == "book" ) {
99
99
newItem . title = trialTitle + " " + sessDate ;
100
100
}
101
+
102
+ newItem . title = newItem . title . trim ( ) . replace ( / [ , . ] + $ / , "" ) ;
103
+ if ( ! newItem . title ) {
104
+ newItem . title = "[no title]" ;
105
+ }
101
106
102
107
var referenceNo = ZU . xpathText ( doc , '//div[@class="ob-panel"][1]/table[@class="ob-info-table"][1]/tbody/tr[th[contains(text(),"Reference")]]/td' ) . trim ( ) ; // changed fetching Reference number
103
108
104
109
newItem . extra = "Reference Number: " + referenceNo ; // putting the ref number in the Extra field had a particular function, was it for Voyant? or the defunct DMCI plugin? retain it at least for now (non trials will want it anyway)
105
110
106
111
if ( newItem . itemType == "case" ) {
107
- newItem . docketNumber = referenceNo ;
112
+ newItem . docketNumber = referenceNo ;
108
113
}
109
114
110
115
if ( newItem . itemType == "book" ) {
@@ -144,7 +149,7 @@ if (newItem.itemType == "case") {
144
149
145
150
// use print-friendly URLs for snapshots
146
151
147
- var attachmentUrl = "https://www.oldbaileyonline.org/print.jsp?div=" + referenceNo ;
152
+ var attachmentUrl = "https://www.oldbaileyonline.org/print.jsp?div=" + referenceNo ;
148
153
newItem . attachments . push ( { url : attachmentUrl , title : "OBO Snapshot" , mimeType : "text/html" } ) ;
149
154
150
155
newItem . complete ( ) ;
@@ -166,7 +171,7 @@ function doWeb(doc, url) {
166
171
}
167
172
ZU . processDocuments ( articles , scrape ) ;
168
173
} ) ;
169
- } else if ( url . includes ( 'browse.jsp' ) && ( url . includes ( 'div=' ) || url . includes ( 'name=' ) ) ) {
174
+ } else if ( url . includes ( 'browse.jsp' ) && ( url . includes ( 'div=' ) || url . includes ( 'name=' ) ) ) {
170
175
scrape ( doc , url ) ;
171
176
}
172
177
}
@@ -186,7 +191,7 @@ var testCases = [
186
191
"items" : [
187
192
{
188
193
"itemType" : "case" ,
189
- "caseName" : "Peter Asterbawd, Andrew Forsman. " ,
194
+ "caseName" : "Peter Asterbawd, Andrew Forsman" ,
190
195
"creators" : [ ] ,
191
196
"dateDecided" : "1800-01-15" ,
192
197
"docketNumber" : "t18000115-12" ,
@@ -233,7 +238,7 @@ var testCases = [
233
238
"creators" : [ ] ,
234
239
"date" : "1711-04-21" ,
235
240
"extra" : "Reference Number: OA17110421" ,
236
- "libraryCatalog" : "Old Bailey Online 201809 " ,
241
+ "libraryCatalog" : "Old Bailey Online" ,
237
242
"place" : "London" ,
238
243
"url" : "https://www.oldbaileyonline.org/browse.jsp?div=OA17110421" ,
239
244
"attachments" : [
@@ -258,7 +263,7 @@ var testCases = [
258
263
"creators" : [ ] ,
259
264
"date" : "1711-04-21" ,
260
265
"extra" : "Reference Number: OA17110421" ,
261
- "libraryCatalog" : "Old Bailey Online 201809 " ,
266
+ "libraryCatalog" : "Old Bailey Online" ,
262
267
"place" : "London" ,
263
268
"url" : "https://www.oldbaileyonline.org/browse.jsp?name=OA17110421" ,
264
269
"attachments" : [
@@ -283,7 +288,7 @@ var testCases = [
283
288
"creators" : [ ] ,
284
289
"date" : "1710-04-18" ,
285
290
"extra" : "Reference Number: 17100418" ,
286
- "libraryCatalog" : "Old Bailey Online 201809 " ,
291
+ "libraryCatalog" : "Old Bailey Online" ,
287
292
"place" : "London" ,
288
293
"url" : "https://www.oldbaileyonline.org/browse.jsp?name=17100418" ,
289
294
"attachments" : [
@@ -304,7 +309,7 @@ var testCases = [
304
309
"items" : [
305
310
{
306
311
"itemType" : "case" ,
307
- "caseName" : ". " ,
312
+ "caseName" : "[no title] " ,
308
313
"creators" : [ ] ,
309
314
"dateDecided" : "1678-08-28" ,
310
315
"docketNumber" : "t16780828-12" ,
0 commit comments