forked from FlominatorTM/WikiTree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompgen_OFBs.js
More file actions
34 lines (28 loc) · 1020 Bytes
/
Copy pathCompgen_OFBs.js
File metadata and controls
34 lines (28 loc) · 1020 Bytes
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
javascript:
/* usage: visit a person's page at online-ofbs.de, optionally select text you want to have in the citation and click this bookmarklet */
var author = "";
for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++)
{
href = aNode.getAttribute("href");
if (href && (""+href).startsWith("mailto:"))
{
author = aNode.innerHTML;
}
}
var urlParams = new URLSearchParams(window.location.search);
var url = " (" + window.location.origin + window.location.pathname + '?ofb=' + urlParams.get('ofb') + "&ID=" + urlParams.get('ID');
var d = new Date();
var dateFormatted = d.toLocaleString("en-GB", {
day: 'numeric',
month: 'long',
year: 'numeric'
});
var urlDate = " : accessed " + dateFormatted + ")";
var citation= author +': ' + document.title.replace(":", ",") + url+ urlDate;
var selected = window.getSelection()+ "";
if (selected.length > 0)
{
citation = citation + " citing: " + selected.replace("\n", " // ");
}
prompt("",citation);
void(0);