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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
|
/*
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
*/
var moduleSearchIndex;
var packageSearchIndex;
var typeSearchIndex;
var memberSearchIndex;
var tagSearchIndex;
var oddRowColor = "odd-row-color";
var evenRowColor = "even-row-color";
var sortAsc = "sort-asc";
var sortDesc = "sort-desc";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
const linkIcon = "Link icon";
const linkToSection = "Link to this section";
function loadScripts(doc, tag) {
createElem(doc, tag, 'script-files/search.js');
createElem(doc, tag, 'module-search-index.js');
createElem(doc, tag, 'package-search-index.js');
createElem(doc, tag, 'type-search-index.js');
createElem(doc, tag, 'member-search-index.js');
createElem(doc, tag, 'tag-search-index.js');
}
function createElem(doc, tag, path) {
var script = doc.createElement(tag);
var scriptElement = doc.getElementsByTagName(tag)[0];
script.src = pathtoroot + path;
scriptElement.parentNode.insertBefore(script, scriptElement);
}
// Helper for making content containing release names comparable lexicographically
function makeComparable(s) {
return s.toLowerCase().replace(/(\d+)/g,
function(n, m) {
return ("000" + m).slice(-4);
});
}
// Switches between two styles depending on a condition
function toggleStyle(classList, condition, trueStyle, falseStyle) {
if (condition) {
classList.remove(falseStyle);
classList.add(trueStyle);
} else {
classList.remove(trueStyle);
classList.add(falseStyle);
}
}
// Sorts the rows in a table lexicographically by the content of a specific column
function sortTable(header, columnIndex, columns) {
var container = header.parentElement;
var descending = header.classList.contains(sortAsc);
container.querySelectorAll("div.table-header").forEach(
function(header) {
header.classList.remove(sortAsc);
header.classList.remove(sortDesc);
}
)
var cells = container.children;
var rows = [];
for (var i = columns; i < cells.length; i += columns) {
rows.push(Array.prototype.slice.call(cells, i, i + columns));
}
var comparator = function(a, b) {
var ka = makeComparable(a[columnIndex].textContent);
var kb = makeComparable(b[columnIndex].textContent);
if (ka < kb)
return descending ? 1 : -1;
if (ka > kb)
return descending ? -1 : 1;
return 0;
};
var sorted = rows.sort(comparator);
var visible = 0;
sorted.forEach(function(row) {
if (row[0].style.display !== 'none') {
var isEvenRow = visible++ % 2 === 0;
}
row.forEach(function(cell) {
toggleStyle(cell.classList, isEvenRow, evenRowColor, oddRowColor);
container.appendChild(cell);
})
});
toggleStyle(header.classList, descending, sortDesc, sortAsc);
}
// Toggles the visibility of a table category in all tables in a page
function toggleGlobal(checkbox, selected, columns) {
const display = checkbox.checked ? '' : 'none';
const selectOther = selected === "other";
const selectAll = selected === "all";
if (selectAll) {
document.querySelectorAll('.checkboxes input[type="checkbox"]').forEach(c => {
c.checked = checkbox.checked;
});
}
document.querySelectorAll("div.table-tabs").forEach(t => {
const id = t.parentElement.getAttribute("id");
const selectedClass = id + "-tab" + (selectOther ? "" : selected);
var visible = 0;
t.parentElement.querySelectorAll('div.' + id)
.forEach(function(elem) {
if (selectAll
|| (!selectOther && elem.classList.contains(selectedClass))
|| (selectOther && elem.className.indexOf(selectedClass) < 0)) {
elem.style.display = display;
}
if (elem.style.display === '') {
var isEvenRow = visible++ % (columns * 2) < columns;
toggleStyle(elem.classList, isEvenRow, evenRowColor, oddRowColor);
}
});
var displaySection = visible === 0 ? 'none' : '';
t.parentElement.style.display = displaySection;
document.querySelector("li#contents-" + id).style.display = displaySection;
})
}
// Shows the elements of a table belonging to a specific category
function show(tableId, selected, columns) {
if (tableId !== selected) {
document.querySelectorAll('div.' + tableId + ':not(.' + selected + ')')
.forEach(function(elem) {
elem.style.display = 'none';
});
}
document.querySelectorAll('div.' + selected)
.forEach(function(elem, index) {
elem.style.display = '';
var isEvenRow = index % (columns * 2) < columns;
toggleStyle(elem.classList, isEvenRow, evenRowColor, oddRowColor);
});
updateTabs(tableId, selected);
}
function updateTabs(tableId, selected) {
document.getElementById(tableId + '.tabpanel')
.setAttribute('aria-labelledby', selected);
document.querySelectorAll('button[id^="' + tableId + '"]')
.forEach(function(tab, index) {
if (selected === tab.id || (tableId === selected && index === 0)) {
tab.className = activeTableTab;
tab.setAttribute('aria-selected', true);
tab.setAttribute('tabindex',0);
} else {
tab.className = tableTab;
tab.setAttribute('aria-selected', false);
tab.setAttribute('tabindex',-1);
}
});
}
function switchTab(e) {
var selected = document.querySelector('[aria-selected=true]');
if (selected) {
if ((e.keyCode === 37 || e.keyCode === 38) && selected.previousSibling) {
// left or up arrow key pressed: move focus to previous tab
selected.previousSibling.click();
selected.previousSibling.focus();
e.preventDefault();
} else if ((e.keyCode === 39 || e.keyCode === 40) && selected.nextSibling) {
// right or down arrow key pressed: move focus to next tab
selected.nextSibling.click();
selected.nextSibling.focus();
e.preventDefault();
}
}
}
var updateSearchResults = function() {};
function indexFilesLoaded() {
return moduleSearchIndex
&& packageSearchIndex
&& typeSearchIndex
&& memberSearchIndex
&& tagSearchIndex;
}
// Copy the contents of the local snippet to the clipboard
function copySnippet(button) {
copyToClipboard(button.nextElementSibling.innerText);
switchCopyLabel(button, button.firstElementChild);
}
function copyToClipboard(content) {
var textarea = document.createElement("textarea");
textarea.style.height = 0;
document.body.appendChild(textarea);
textarea.value = content;
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
}
function switchCopyLabel(button, span) {
var copied = span.getAttribute("data-copied");
button.classList.add("visible");
var initialLabel = span.innerHTML;
span.innerHTML = copied;
setTimeout(function() {
button.classList.remove("visible");
setTimeout(function() {
if (initialLabel !== copied) {
span.innerHTML = initialLabel;
}
}, 100);
}, 1900);
}
function setTopMargin() {
// Dynamically set scroll margin to accomodate for draft header
var headerHeight = Math.ceil(document.querySelector("header").offsetHeight);
document.querySelector(":root")
.style.setProperty("--nav-height", headerHeight + "px");
}
document.addEventListener("readystatechange", (e) => {
if (document.readyState === "interactive") {
setTopMargin();
}
if (sessionStorage.getItem("sidebar") === "hidden") {
const sidebar = document.querySelector(".main-grid nav.toc");
if (sidebar) sidebar.classList.add("hide-sidebar");
}
});
document.addEventListener("DOMContentLoaded", function(e) {
setTopMargin();
// Make sure current element is visible in breadcrumb navigation on small displays
const subnav = document.querySelector("ol.sub-nav-list");
if (subnav && subnav.lastElementChild) {
subnav.lastElementChild.scrollIntoView({ behavior: "instant", inline: "start", block: "nearest" });
}
// Clone TOC sidebar to header for mobile navigation
const navbar = document.querySelector("div#navbar-top");
const sidebar = document.querySelector(".main-grid nav.toc");
const main = document.querySelector(".main-grid main");
const mainnav = navbar.querySelector("ul.nav-list");
const toggleButton = document.querySelector("button#navbar-toggle-button");
const toc = sidebar ? sidebar.cloneNode(true) : null;
if (toc) {
navbar.appendChild(toc);
}
document.querySelectorAll("input.filter-input").forEach(function(input) {
input.removeAttribute("disabled");
input.setAttribute("autocapitalize", "off");
input.value = "";
input.addEventListener("input", function(e) {
const pattern = input.value ? input.value.trim()
.replace(/[\[\]{}()*+?.\\^$|]/g, '\\$&')
.replace(/\s+/g, ".*") : "";
input.nextElementSibling.style.display = pattern ? "inline" : "none";
const filter = new RegExp(pattern, "i");
input.parentNode.parentNode.querySelectorAll("ol.toc-list li").forEach((li) => {
if (filter.test(li.innerText)) {
li.removeAttribute("style");
} else {
li.style.display = "none";
}
});
if (expanded) {
expand();
}
});
});
document.querySelectorAll("input.reset-filter").forEach((button) => {
button.removeAttribute("disabled");
button.addEventListener("click", (e) => {
const input = button.previousElementSibling;
input.value = "";
input.dispatchEvent(new InputEvent("input"));
input.focus();
if (expanded) {
expand();
} else {
prevHash = null;
handleScroll();
}
})
});
var expanded = false;
var windowWidth;
function collapse() {
if (expanded) {
mainnav.removeAttribute("style");
if (toc) {
toc.removeAttribute("style");
}
toggleButton.classList.remove("expanded")
toggleButton.setAttribute("aria-expanded", "false");
expanded = false;
}
}
function expand() {
expanded = true;
mainnav.style.display = "block";
mainnav.style.removeProperty("height");
var maxHeight = window.innerHeight - subnav.offsetTop + 4;
var expandedHeight = Math.min(maxHeight, mainnav.scrollHeight + 10);
if (toc) {
toc.style.display = "flex";
expandedHeight = Math.min(maxHeight,
Math.max(expandedHeight, toc.querySelector("div.toc-header").offsetHeight
+ toc.querySelector("ol.toc-list").scrollHeight + 10));
toc.style.height = expandedHeight + "px";
}
mainnav.style.height = expandedHeight + "px";
toggleButton.classList.add("expanded");
toggleButton.setAttribute("aria-expanded", "true");
windowWidth = window.innerWidth;
}
toggleButton.addEventListener("click", (e) => {
if (expanded) {
collapse();
} else {
expand();
}
});
if (toc) {
toc.querySelectorAll("a").forEach((link) => {
link.addEventListener("click", collapse);
});
}
document.addEventListener('keydown', (e) => {
if (e.key === "Escape") collapse();
});
document.querySelector("main").addEventListener("click", collapse);
const searchInput = document.getElementById("search-input");
if (searchInput) searchInput.addEventListener("focus", collapse);
document.querySelectorAll("h1, h2, h3, h4, h5, h6")
.forEach((hdr, idx) => {
// Create anchor links for headers with an associated id attribute
var id = hdr.getAttribute("id") || hdr.parentElement.getAttribute("id")
|| (hdr.querySelector("a") && hdr.querySelector("a").getAttribute("id"));
if (id) {
var template = document.createElement('template');
template.innerHTML =" <a href='#" + encodeURI(id) + "' class='anchor-link' aria-label='" + linkToSection
+ "'><img src='" + pathtoroot + "resource-files/link.svg' alt='" + linkIcon +"' tabindex='0'"
+ " width='16' height='16'></a>";
hdr.append(...template.content.childNodes);
}
});
var sections;
var scrollTimeout;
var scrollTimeoutNeeded;
var prevHash;
function initSectionData() {
sections = [{ id: "", top: 0 }].concat(Array.from(main.querySelectorAll("section[id], h2[id], h2 a[id], div[id]"))
.filter((e) => {
return sidebar.querySelector("a[href=\"#" + encodeURI(e.getAttribute("id")) + "\"]") !== null
}).map((e) => {
return {
id: e.getAttribute("id"),
top: e.offsetTop
};
}));
}
function setScrollTimeout() {
clearTimeout(scrollTimeout);
scrollTimeoutNeeded = false;
scrollTimeout = setTimeout(() => {
scrollTimeout = null;
handleScroll();
}, 100);
}
function handleScroll() {
if (!sidebar || !sidebar.offsetParent || sidebar.classList.contains("hide-sidebar")) {
return;
}
if (scrollTimeout || scrollTimeoutNeeded) {
setScrollTimeout();
return;
}
var scrollTop = document.documentElement.scrollTop;
var scrollHeight = document.documentElement.scrollHeight;
var currHash = null;
if (scrollHeight - scrollTop < window.innerHeight + 10) {
// Select last item if at bottom of the page
currHash = "#" + encodeURI(sections.at(-1).id);
} else {
for (var i = 0; i < sections.length; i++) {
var top = sections[i].top;
var bottom = sections[i + 1] ? sections[i + 1].top : scrollHeight;
if (top + ((bottom - top) / 2) > scrollTop || bottom > scrollTop + (window.innerHeight / 3)) {
currHash = "#" + encodeURI(sections[i].id);
break;
}
}
}
if (currHash !== prevHash) {
setSelected(currHash);
}
}
function setSelected(hash) {
var prev = sidebar.querySelector("a.current-selection");
if (prev)
prev.classList.remove("current-selection");
prevHash = hash;
if (hash) {
var curr = sidebar.querySelector("ol.toc-list a[href=\"" + hash + "\"]");
if (curr) {
curr.classList.add("current-selection");
curr.scrollIntoView({ behavior: "instant", block: "nearest" });
}
}
}
if (sidebar) {
initSectionData();
document.querySelectorAll("a[href^='#']").forEach((link) => {
link.addEventListener("click", (e) => {
scrollTimeoutNeeded = true;
setSelected(link.getAttribute("href"));
})
});
sidebar.querySelector("button.hide-sidebar").addEventListener("click", () => {
sidebar.classList.add("hide-sidebar");
sessionStorage.setItem("sidebar", "hidden");
});
sidebar.querySelector("button.show-sidebar").addEventListener("click", () => {
sidebar.classList.remove("hide-sidebar");
sessionStorage.removeItem("sidebar");
initSectionData();
handleScroll();
});
window.addEventListener("hashchange", (e) => {
scrollTimeoutNeeded = true;
});
if (document.location.hash) {
scrollTimeoutNeeded = true;
setSelected(document.location.hash);
} else {
handleScroll();
}
window.addEventListener("scroll", handleScroll);
window.addEventListener("scrollend", () => {
if (scrollTimeout) {
clearTimeout(scrollTimeout);
scrollTimeout = null;
handleScroll();
}
})
}
// Resize handler
function handleResize(e) {
if (expanded) {
if (windowWidth !== window.innerWidth) {
collapse();
} else {
expand();
}
}
if (sections) {
initSectionData();
prevHash = null;
handleScroll();
}
setTopMargin();
}
window.addEventListener("orientationchange", handleResize);
window.addEventListener("resize", handleResize);
});
|