Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
74 lines (67 loc) · 3.1 KB
/
Copy pathindex.html
File metadata and controls
74 lines (67 loc) · 3.1 KB
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
<!doctype html>
<html>
<head>
<title>LC Prints and Photographs Wikipedia Image Citation Generator</title>
<link rel="stylesheet" href="css/style.css" type='text/css'>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script src="js/wikippoc.js"></script>
<script>
var args = function() {
var a = Array();
if (window.location.search && window.location.search.length > 1) {
var pairs = window.location.search.substring(1).split('&');
while (pairs.length) {
var pair = pairs.pop().split('=');
a[pair[0]] = pair[1];
}
}
return a;
}();
var fileNameEnabled = true;
$(document).ready(function() {
if ("url" in args)
$("#ppocUrl").attr("value", args["url"]);
if ("file" in args) {
$("#ppocFile").attr("value", args["file"]);
fileNameEnabled = true;
} else if ($("#ppocFile").attr("value") === "" ||
$("#ppocFile").attr("value") === "(optional)") {
$("#ppocFile").focus(function () {
$("#ppocFile").css("color", "");
$("#ppocFile").attr("value", "");
fileNameEnabled = true;
});
$("#ppocFile").css("color", "#999");
$("#ppocFile").attr("value", "(optional)");
fileNameEnabled = false;
}
});
function lookup() {
var ppocUrl = $("#ppocUrl").attr("value");
var ppocFile = fileNameEnabled
? $("#ppocFile").attr("value")
: undefined;
wikippoc(ppocUrl, function(pic) {
var ppoc = $('<div id="ppoc">')
.append('<a target="_new" href="' + pic.link + '"><img src="'+ pic.thumb_gallery + '"></a>')
.append("<br><span class='title'>" + pic.title + "</span>");
$("#ppoc").replaceWith(ppoc);
$("#wikitext").text(pic.wikitext);
}, ppocFile);
}
$(document).ready(lookup);
</script>
</head>
<body>
<header>LC Prints and Photographs Wikipedia Image Citation Generator</header>
<a id="github" href="http://github.com/edsu/wikippoc"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 3;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
<form action="javascript:lookup()">
<div id="ppoc"></div>
URL or LC Digital ID: <input id="ppocUrl" type="text" size="50" value="http://www.loc.gov/pictures/resource/cph.3c13276/"><br/>
Commons file name: <input id="ppocFile" type="text" size="50" value=""><br/>
<input type="submit" value="generate">
<div id="wikitext"></div>
</div>
</form>
</body>
</html>