-
Notifications
You must be signed in to change notification settings - Fork 7
/
handwriting_test.html
92 lines (86 loc) · 3.69 KB
/
handwriting_test.html
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
<html>
<head>
<style>
.button {
-moz-box-shadow: 0px 0px 0px 2px #9fb4f2;
-webkit-box-shadow: 0px 0px 0px 2px #9fb4f2;
box-shadow: 0px 0px 0px 2px #9fb4f2;
background-color:#7892c2;
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
border:1px solid #4e6096;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size:16;
padding:12px 37px;
text-decoration:none;
text-shadow:0px 1px 0px #283966;
}
.non-button {
-moz-box-shadow: 0px 0px 0px 2px #4D5656;
-webkit-box-shadow: 0px 0px 0px 2px #4D5656;
box-shadow: 0px 0px 0px 2px #4D5656;
background-color:#E5E8E8;
-moz-border-radius:10px;
-webkit-border-radius:10px;
border-radius:10px;
border:1px solid #424949;
display:inline-block;
cursor:pointer;
color:#000000;
font-family:Arial;
font-size:16;
padding:12px 37px;
text-decoration:none;
text-shadow:0px 0px 0px #283966;
}
.button:hover {
background-color:#666666;
}
.button:active {
position:relative;
top:1px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
display = function() {
jQuery.post('https://catalog.archives.gov/api/v1/login', {user: 'NARACatalogDemo', password: 'C0ntribute!'}, function(x) {
credential = x.opaResponse.credentials;
$('#img').html('<br/><img src="https://upload.wikimedia.org/wikipedia/commons/a/a3/Lightness_rotate_36f_cw.gif"/><br/><strong>finding image...</strong>');
url = 'https://catalog.archives.gov/api/v1?objects.object.publicContributions.tags.tag_not=%22handwriting%22%20or%20%22typed%22%20or%20%22cannot%20be%20transcribed%22%20or%20%22handwriting/typed%22&type=object&description.fileUnit.generalRecordsTypeArray.generalRecordsType.naId_is=10035676&resultFields=parentDescriptionNaId,num,objects.object.file,objects.object.technicalMetadata&rows=1&cursorMark=' + cursor + '&sort=naIdSort%20asc'
$.getJSON(url, function(t) {
img = t.opaResponse.results.result[0].objects.object.file['@url'];
naid = t.opaResponse.results.result[0].parentDescriptionNaId;
height = t.opaResponse.results.result[0].objects.object.technicalMetadata.height;
px = 600;
object_id = t.opaResponse.results.result[0].objects.object['@id']
cursor = t.opaResponse.results.nextCursorMark
$('#img').html('<table><tr><td rowspan="2"><a href="https://catalog.archives.gov/id/' + naid + '"><img height="' + px + ' pixels" src="' + img + '"/></a></td><td valign="top"></td></tr><tr valign="bottom"><td><button class="button" onclick="tag(naid, object_id, \'handwriting\')">Handwriting</button><br/><br/><button width="200px" class="button" onclick="tag(naid, object_id, \'typed\')">Typed</button><br/><br/><button width="200" class="button" onclick="tag(naid, object_id, \'handwriting/typed\')">Both</button><br/><br/><button width="200" class="button" onclick="tag(naid, object_id, \'cannot be transcribed\')">Can\'t be transcribed</button><br/><br/><hr><br/><button onclick="display(cursor)" width="200" class="non-button">< Skip ></button></td></tr></table>')
});
}, 'json');
}
cursor = '*'
display(cursor)
tag = function(naid, object_id, tagtext) {
$.ajax({
beforeSend: function(request) {
request.setRequestHeader('Authorization', credential);
},
dataType: "json",
url: 'https://catalog.archives.gov/api/v1/id/' + naid + '/objects/' + object_id + '/tags?text=' + tagtext,
method: 'POST'
});
display(cursor)
}
});
</script>
</head>
<body>
<center><span id="img"><br/><img src="https://upload.wikimedia.org/wikipedia/commons/a/a3/Lightness_rotate_36f_cw.gif"/><br/><strong>finding image...</strong></span></center>\
</body>
</html>