-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfooter.inc
208 lines (196 loc) · 8.59 KB
/
footer.inc
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!-- Cookie Consent -->
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
<script>
{% if request.lang == 'fi' %}
cookieMessage = "Finto.fi-sivusto käyttää evästeitä käyttäjän kieliasetusten muistamiseen sekä käytön tilastointiin. Käyttämällä Finto.fi-sivustoa hyväksyt evästeiden käytön.";
cookieDismiss = "Selvä!";
cookieLink = "Lue lisää";
cookieHref = "https://www.kiwi.fi/x/2zOOBQ";
{% elseif request.lang == 'sv' %}
cookieMessage = "Finto.fi-sidan använder cookies för att komma ihåg användares språkinställningar och för användningsstatistik. Genom att använda Finto.fi-sidan godkänner du användningen av cookies.";
cookieDismiss = "Klart!";
cookieLink = "Läs mer";
cookieHref = "https://www.kiwi.fi/x/3jOOBQ";
{% elseif request.lang == 'en' %}
cookieMessage = "Finto.fi uses cookies to store language preferences and compile usage statistics. By using finto.fi you accept the use of cookies.";
cookieDismiss = "Got it!";
cookieLink = "Learn more";
cookieHref = "https://www.kiwi.fi/x/4DOOBQ";
{% endif %}
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#d4edeb",
"text": "#333333"
},
"button": {
"background": "#394554",
"text": "#ffffff"
}
},
"theme": "edgeless",
"content": {
"message": cookieMessage,
"dismiss": cookieDismiss,
"link": cookieLink,
"href": cookieHref
}
})});
</script>
<!-- End Cookie consent -->
<script type="text/javascript">
function createConceptObject(conceptUri, conceptData) {
var newNode = {
text: getLabel(conceptData),
a_attr: getHrefForUri(conceptData.uri),
uri: conceptUri,
notation: conceptData.notation,
parents: conceptData.broader,
state: { opened: true },
children: []
};
// adding a css class for separating the yso concepts from the special domain ontology concepts
if (vocab !== 'yso' && newNode.uri.indexOf('www.yso.fi/onto/yso/') !== -1)
newNode.a_attr['class'] = 'yso-concept';
// setting the flag manually if the concept is known to have narrowers, but they aren't included eg. included topconcepts
if(conceptData.hasChildren === true) {
newNode.children = true;
newNode.state.opened = false;
}
// if we are at a concept page we want to highlight that node and mark it as to be initially opened.
if (newNode.uri === window.uri) { newNode.li_attr = { class: 'jstree-leaf-proper' }; }
if (conceptData.narrower) { // filtering out the ones that don't have labels
newNode.children = createObjectsFromChildren(conceptData, conceptUri);
}
return newNode;
}
function createObjectsFromChildren(conceptData, conceptUri) {
var childArray = [];
for (var i = 0; i < conceptData.narrower.length; i++) {
var childObject = {
text: getLabel(conceptData.narrower[i]),
a_attr: getHrefForUri(conceptData.narrower[i].uri),
uri: conceptData.narrower[i].uri,
notation: conceptData.narrower[i].notation,
parents: conceptUri,
state: { opened: true }
};
if (vocab !== 'yso' && childObject.uri.indexOf('www.yso.fi/onto/yso/') !== -1)
childObject.a_attr['class'] = 'yso-concept';
// if the childConcept hasn't got any children the state is not needed.
if (conceptData.narrower[i].hasChildren) {
childObject.children = true;
childObject.state.opened = false;
}
if(!childArray[childObject.uri])
childArray.push(childObject);
storeUri(childObject);
}
return childArray;
}
function vocabRoot(topConcepts) {
var topArray = [];
for (var i = 0; i < topConcepts.length; i++) {
var conceptData = topConcepts[i];
var childObject = {
text: getLabel(conceptData),
a_attr : getHrefForUri(conceptData.uri),
uri: conceptData.uri,
notation: conceptData.notation,
state: { opened: false }
};
if (vocab !== 'yso' && childObject.uri.indexOf('www.yso.fi/onto/yso/') !== -1)
childObject.a_attr['class'] = 'yso-concept';
if (conceptData.hasChildren)
childObject.children = true;
setNode(childObject);
topArray.push(childObject);
}
return topArray;
}
function createObjectsFromNarrowers(narrowerResponse) {
var childArray = [];
for (var i = 0; i < narrowerResponse.narrower.length; i++) {
var conceptObject = narrowerResponse.narrower[i];
var childObject = {
text : getLabel(conceptObject),
a_attr : getHrefForUri(conceptObject.uri),
uri: conceptObject.uri,
notation: conceptObject.notation,
parents: narrowerResponse.uri,
state: { opened: false, disabled: false, selected: false }
};
if (vocab !== 'yso' && childObject.uri.indexOf('www.yso.fi/onto/yso/') !== -1)
childObject.a_attr['class'] = 'yso-concept';
childObject.children = conceptObject.hasChildren ? true : false;
setNode(childObject);
childArray.push(childObject);
}
return childArray;
}
</script>
<!-- KANTO/finaf tweaks -->
<script type="text/javascript">
function finaf_tweak() {
$(".prop-rdaa_P50094 li:not(.finaf-adjusted), .prop-rdaa_P50006 li:not(.finaf-adjusted)").each(function(index) {
$(this).addClass("finaf-adjusted"); // prevent infinity loop
$(this).find('> span').each(function(sIndex) {
if (this.textContent.startsWith("Asteri ID:")) {
var asteriSpan = $("<span id='finaf-adjusted-" + index + "s" + sIndex + "'>" + this.textContent.substr(11) + "</span>");
$(this).text("Asteri ID: ");
var copyObject = $("#uri-input-box + button.copy-clipboard").clone(true);
copyObject.attr("for", "#finaf-adjusted-" + index + "s" + sIndex).css("margin-left", "4px");
$(this).after(copyObject).after(asteriSpan);
}
if (this.textContent.startsWith("Y-tunnus:")) {
var yTunnusSpan = $("<span id='finaf-adjusted-" + index + "s" + sIndex + "'>" + this.textContent.substr(10) + "</span>");
$(this).text("Y-tunnus: ");
var copyObject = $("#uri-input-box + button.copy-clipboard").clone(true);
copyObject.attr("for", "#finaf-adjusted-" + index + "s" + sIndex).css("margin-left", "4px");
$(this).after(copyObject).after(yTunnusSpan);
}
});
$(this).find('a').each(function(aIndex) {
var href = $(this).attr('href');
if (href.startsWith('http:\/\/isni.org/isni/')) {
$("<span>ISNI: </span>").insertBefore($(this));
isni = href.replace('http:\/\/isni.org/isni/', '');
isnistr = isni.substr(0, 4) + " " + isni.substr(4, 4) + " " + isni.substr(8, 4) + " " + isni.substr(12, 4);
$(this).text(isnistr);
$(this).attr("id", "finaf-adjusted-" + index + "a" + aIndex);
var copyObject = $("#uri-input-box + button.copy-clipboard").clone(true);
copyObject.attr("for", "#finaf-adjusted-" + index + "a" + aIndex).css("margin-left", "4px");
$(this).after(copyObject);
}
if (href.startsWith('https:\/\/orcid.org/')) {
$('<span class="orcid">ORCID:</span>').insertBefore($(this));
orcid = href.replace('https:\/\/orcid.org/', '');
$(this).text(orcid);
$(this).attr("id", "finaf-adjusted-" + index + "a" + aIndex);
var copyObject = $("#uri-input-box + button.copy-clipboard").clone(true);
copyObject.attr("for", "#finaf-adjusted-" + index + "a" + aIndex).css("margin-left", "4px");
$(this).after(copyObject);
}
if (href.startsWith('http:\/\/viaf.org/viaf/')) {
$('<span>VIAF ID: </span>').insertBefore($(this));
viaf = href.replace('http:\/\/viaf.org/viaf/', '');
$(this).text(viaf);
$(this).attr("id", "finaf-adjusted-" + index + "a" + aIndex);
var copyObject = $("#uri-input-box + button.copy-clipboard").clone(true);
copyObject.attr("for", "#finaf-adjusted-" + index + "a" + aIndex).css("margin-left", "4px");
$(this).after(copyObject);
}
});
});
}
$( document ).ready(function() {
if (vocab === "finaf") {
finaf_tweak(); // do immediately
const mainContentNode = document.getElementById("maincontent");
const observer = new MutationObserver(finaf_tweak);
observer.observe(mainContentNode, {childList: true, subtree: true});
}
});
</script>