forked from FlominatorTM/WikiTree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDFG-Viewer.js
More file actions
62 lines (51 loc) · 1.44 KB
/
Copy pathDFG-Viewer.js
File metadata and controls
62 lines (51 loc) · 1.44 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
javascript:
var unknown = "unknown document structure, please report to Straub-620";
var labelTitle = document.getElementsByClassName("tx-dlf-title")[0].innerText;
if(labelTitle != "Titel")
{
alert(unknown);
}
var ddTitle = document.getElementsByClassName("tx-dlf-title")[1];
var ddAuthor = ddTitle.nextSibling.nextSibling;
var title = ddTitle.innerText;
var author = ddAuthor.innerText;
var urlParts = window.location.search.substr(1).split("&");
var page ="";
var signature = "";
for (var i=1; urlParameter = urlParts[i]; i++)
{
urlParameter = decodeURIComponent(urlParameter);
if(urlParameter.indexOf("tx_dlf[page]") > -1)
{
page = urlParameter.split("=")[1];
}
/* https://digitalisate-he.arcinsys.de/hstam/903/9121.xml */
if(urlParameter.indexOf("tx_dlf[id]") > -1)
{
urlParameter = urlParameter.replace(".xml", "").replace("https://", "");
parameterParts = urlParameter.split("/");
if(parameterParts[1] == "hstam")
{
signature = "HStAM Bestand " + parameterParts[2] + " Nr. " + parameterParts[3];
}
else
{
alert(unknown);
}
}
}
var d = new Date();
var dateFormatted = d.toLocaleString("en-GB", {
day: 'numeric',
month: 'long',
year: 'numeric'
});
var urlDate = " : accessed " + dateFormatted + ")";
var citation = "";
if(signature != "")
{
citation += signature + ", ";
}
citation += author + ", " + title + ", image " + page + " ([" + window.location +" DFG-Viewer]"+ urlDate;
prompt("",citation);
void(0);