-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDFG-Viewer.js
More file actions
141 lines (127 loc) · 4.4 KB
/
Copy pathDFG-Viewer.js
File metadata and controls
141 lines (127 loc) · 4.4 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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);
}
let nr = "";
var urlParts = window.location.search.substr(1).split("&");
var page = "";
var signature = "";
var ddTitle = document.getElementsByClassName("tx-dlf-title")[1];
var author = "";
var title = ddTitle.innerText;
for (var i = 1; (urlParameter = urlParts[i]); i++) {
urlParameter = decodeURIComponent(urlParameter);
console.log("urlParameter:" + 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") {
author = "Hessisches Staatsarchiv Marburg";
/* meanwhile included in text
signature = "HStAM Bestand " + parameterParts[2] + " Nr. " + parameterParts[3];
*/
} else if (parameterParts[1] == "hhstaw") {
author = "Hessisches Hauptstaatsarchiv Wiesbaden";
/* Geburtsregister der Juden von Mansbach (Hohenroda) 1847-1902 (HHStAW Abt. 365 Nr. 553)*/
const indexSignature = title.indexOf("(HHStAW");
if (indexSignature > -1) {
signature = title
.substr(indexSignature)
.replace(")", "")
.replace("(", "")
.trim();
title = title.substr(0, indexSignature).trim();
}
} else if (urlParameter.indexOf("www.arcinsys.niedersachsen.de") > -1) {
signature = ddTitle.nextSibling.nextSibling.innerText;
author = ddTitle.nextSibling.nextSibling.nextSibling.innerText;
} else if (urlParameter.indexOf("landesarchiv-nrw") > -1) {
author = "Landesarchiv Nordrhein-Westfalen";
} else if (
urlParameter.indexOf("digitales-archiv.erzbistum-koeln.de") > -1
) {
/*
<dd class="tx-dlf-title">Titel: Tauf-, Heirats- und Sterbebuch</dd><dt>Kontext</dt><dd>Bestand: Kirchenbücher (KB / KBN)</dd><dt>Signatur</dt><dd>KBN00870</dd>
*/
nr = ", #";
title = title.replace("Titel: ", "");
author = "Archiv des Erzbistums Köln";
signature = ddTitle.nextSibling.nextSibling.innerText.replace(
"Bestand: ",
""
);
signature +=
", Signatur " +
ddTitle.nextSibling.nextSibling.nextSibling.nextSibling.innerText;
const scriptTags = document.getElementsByTagName("script");
for (let i = 0; i < scriptTags.length; i++) {
if (scriptTags[i].innerHTML.includes("DATA")) {
const scriptParts = scriptTags[i].innerHTML.split(
"picturearchive\\/DE_AEK_KB\\/"
);
title += ", " + decodeURIComponent(scriptParts[1].split("\\")[0]);
}
}
} else if (
urlParameter.indexOf("digitales-archiv.erzbistum-muenchen.de") > -1
) {
nr = ", #";
/*
<dt class="tx-dlf-title">Titel</dt><dd class="tx-dlf-title">Titel: Taufen</dd><dt>Kontext</dt><dd>Bestand: CB353 Partenkirchen-Mariä Himmelfahrt - 1661-1915</dd><dt>Signatur</dt><dd>CB353, M5290</dd>
*/
title = title.replace("Titel: ", "");
author = "Archiv des Erzbistums München";
const sigRaw = ddTitle.nextSibling.nextSibling.innerText.replace(
"Bestand: ",
""
);
signature = sigRaw.substring(sigRaw.indexOf(" ")).trim();
signature += ", " + title;
signature +=
", Signatur " +
ddTitle.nextSibling.nextSibling.nextSibling.nextSibling.innerText.replace(
", ",
"/"
);
/*
moving signature to title, since title "Taufen" would have a weird position else
... or signature would end with two commas
*/
title = signature;
signature = "";
} else {
NotifyFlo(
"unknown document structure (2), would you like to reach out to Flo to fix this?"
);
}
}
}
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;