Arkistointi
This commit is contained in:
1 parent
1d8cda35f8
commit
17b53a38cf
93 files changed
+8476
-1
No files matched your search
@@ -0,0 +1,2 @@
|
||||
/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */
|
||||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}function fe(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}ce.fn=ce.prototype={jquery:t,constructor:ce,length:0,toArray:function(){return ae.call(this)},get:function(e){return null==e?ae.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ce.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ce.each(this,e)},map:function(n){return this.pushStack(ce.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(ae.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ce.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ce.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:s,sort:oe.sort,splice:oe.splice},ce.extend=ce.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||v(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(ce.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||ce.isPlainObject(n)?n:{},i=!1,a[t]=ce.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},ce.extend({expando:"jQuery"+(t+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==i.call(e))&&(!(t=r(e))||"function"==typeof(n=ue.call(t,"constructor")&&t.constructor)&&o.call(n)===a)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){m(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(c(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},text:function(e){var t,n="",r=0,i=e.nodeType;if(!i)while(t=e[r++])n+=ce.text(t);return 1===i||11===i?e.textContent:9===i?e.documentElement.textContent:3===i||4===i?e.nodeValue:n},makeArray:function(e,t){var n=t||[];return null!=e&&(c(Object(e))?ce.merge(n,"string"==typeof e?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},isXMLDoc:function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!l.test(t||n&&n.nodeName||"HTML")},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(c(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:le}),"function"==typeof Symbol&&(ce.fn[Symbol.iterator]=oe[Symbol.iterator]),ce.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var pe=oe.pop,de=oe.sort,he=oe.splice,ge="[\\x20\\t\\r\\n\\f]",ve=new RegExp("^"+ge+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ge+"+$","g");ce.contains=function(e,t){var n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var f=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function p(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}ce.escapeSelector=function(e){return(e+"").replace(f,p)};var ye=C,me=s;!function(){var e,b,w,o,a,T,r,C,d,i,k=me,S=ce.expando,E=0,n=0,s=W(),c=W(),u=W(),h=W(),l=function(e,t){return e===t&&(a=!0),0},f="checked|selected|async|autofocus|autoplay|conLine truncated
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*! jQuery UI - v1.13.2 - 2023-02-27
|
||||
* http://jqueryui.com
|
||||
* Includes: widget.js, position.js, keycode.js, unique-id.js, widgets/autocomplete.js, widgets/menu.js
|
||||
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";x.ui=x.ui||{};x.ui.version="1.13.2";var n,i=0,l=Array.prototype.hasOwnProperty,a=Array.prototype.slice;x.cleanData=(n=x.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");n(t)}),x.widget=function(t,i,e){var s,n,o,l={},a=t.split(".")[0],r=a+"-"+(t=t.split(".")[1]);return e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[r.toLowerCase()]=function(t){return!!x.data(t,r)},x[a]=x[a]||{},s=x[a][t],n=x[a][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},x.extend(n,s,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(o=new i).options=x.widget.extend({},o.options),x.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}l[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=x.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},l,{constructor:n,namespace:a,widgetName:t,widgetFullName:r}),s?(x.each(s._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),x.widget.bridge(t,n),n},x.widget.extend=function(t){for(var e,i,s=a.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],l.call(s[n],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(o,e){var l=e.prototype.widgetFullName||o;x.fn[o]=function(i){var t="string"==typeof i,s=a.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,l);return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+o+" widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=x.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=x.data(this,l);t?(t.option(i||{}),t._init&&t._init()):x.data(this,l,new e(i,this))})),n}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=x.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=x(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({diLine truncated
|
||||
@@ -0,0 +1,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);
|
||||
});
|
||||
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
$(function() {
|
||||
var copy = $("#page-search-copy");
|
||||
var expand = $("#page-search-expand");
|
||||
var searchLink = $("span#page-search-link");
|
||||
var redirect = $("input#search-redirect");
|
||||
function setSearchUrlTemplate() {
|
||||
var href = document.location.href.split(/[#?]/)[0];
|
||||
href += "?q=" + "%s";
|
||||
if (redirect.is(":checked")) {
|
||||
href += "&r=1";
|
||||
}
|
||||
searchLink.html(href);
|
||||
copy[0].onmouseenter();
|
||||
}
|
||||
function copyLink(e) {
|
||||
copyToClipboard(this.previousSibling.innerText);
|
||||
switchCopyLabel(this, this.lastElementChild);
|
||||
}
|
||||
copy.click(copyLink);
|
||||
copy[0].onmouseenter = function() {};
|
||||
redirect.click(setSearchUrlTemplate);
|
||||
setSearchUrlTemplate();
|
||||
copy.prop("disabled", false);
|
||||
redirect.prop("disabled", false);
|
||||
expand.click(function (e) {
|
||||
var searchInfo = $("div.page-search-info");
|
||||
if(this.parentElement.hasAttribute("open")) {
|
||||
searchInfo.attr("style", "border-width: 0;");
|
||||
} else {
|
||||
searchInfo.attr("style", "border-width: 1px;").height(searchInfo.prop("scrollHeight"));
|
||||
}
|
||||
});
|
||||
});
|
||||
$(window).on("load", function() {
|
||||
var input = $("#page-search-input");
|
||||
var reset = $("#page-search-reset");
|
||||
var notify = $("#page-search-notify");
|
||||
var resultSection = $("div#result-section");
|
||||
var resultContainer = $("div#result-container");
|
||||
var searchTerm = "";
|
||||
var activeTab = "";
|
||||
var fixedTab = false;
|
||||
var visibleTabs = [];
|
||||
var feelingLucky = false;
|
||||
function renderResults(result) {
|
||||
if (!result.length) {
|
||||
notify.html(messages.noResult);
|
||||
} else if (result.length === 1) {
|
||||
notify.html(messages.oneResult);
|
||||
} else {
|
||||
notify.html(messages.manyResults.replace("{0}", result.length));
|
||||
}
|
||||
resultContainer.empty();
|
||||
var r = {
|
||||
"types": [],
|
||||
"members": [],
|
||||
"packages": [],
|
||||
"modules": [],
|
||||
"searchTags": []
|
||||
};
|
||||
for (var i in result) {
|
||||
var item = result[i];
|
||||
var arr = r[item.category];
|
||||
arr.push(item);
|
||||
}
|
||||
if (!activeTab || r[activeTab].length === 0 || !fixedTab) {
|
||||
Object.keys(r).reduce(function(prev, curr) {
|
||||
if (r[curr].length > 0 && r[curr][0].score > prev) {
|
||||
activeTab = curr;
|
||||
return r[curr][0].score;
|
||||
}
|
||||
return prev;
|
||||
}, 0);
|
||||
}
|
||||
if (feelingLucky && activeTab) {
|
||||
notify.html(messages.redirecting)
|
||||
var firstItem = r[activeTab][0];
|
||||
window.location = getURL(firstItem.indexItem, firstItem.category);
|
||||
return;
|
||||
}
|
||||
if (result.length > 20) {
|
||||
if (searchTerm[searchTerm.length - 1] === ".") {
|
||||
if (activeTab === "types" && r["members"].length > r["types"].length) {
|
||||
activeTab = "members";
|
||||
} else if (activeTab === "packages" && r["types"].length > r["packages"].length) {
|
||||
activeTab = "types";
|
||||
}
|
||||
}
|
||||
}
|
||||
var categoryCount = Object.keys(r).reduce(function(prev, curr) {
|
||||
return prev + (r[curr].length > 0 ? 1 : 0);
|
||||
}, 0);
|
||||
visibleTabs = [];
|
||||
var tabContainer = $("<div class='table-tabs'></div>").appendTo(resultContainer);
|
||||
for (var key in r) {
|
||||
var id = "#result-tab-" + key.replace("searchTags", "search_tags");
|
||||
if (r[key].length) {
|
||||
var count = r[key].length >= 1000 ? "999+" : r[key].length;
|
||||
if (result.length > 20 && categoryCount > 1) {
|
||||
var button = $("<button id='result-tab-" + key
|
||||
+ "' class='page-search-header'><span>" + categories[key] + "</span>"
|
||||
+ "<span style='font-weight: normal'> (" + count + ")</span></button>").appendTo(tabContainer);
|
||||
button.click(key, function(e) {
|
||||
fixedTab = true;
|
||||
renderResult(e.data, $(this));
|
||||
});
|
||||
visibleTabs.push(key);
|
||||
} else {
|
||||
$("<span class='page-search-header active-table-tab'>" + categories[key]
|
||||
+ "<span style='font-weight: normal'> (" + count + ")</span></span>").appendTo(tabContainer);
|
||||
renderTable(key, r[key]).appendTo(resultContainer);
|
||||
tabContainer = $("<div class='table-tabs'></div>").appendTo(resultContainer);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (activeTab && result.length > 20 && categoryCount > 1) {
|
||||
$("button#result-tab-" + activeTab).addClass("active-table-tab");
|
||||
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
|
||||
}
|
||||
resultSection.show();
|
||||
function renderResult(category, button) {
|
||||
activeTab = category;
|
||||
setSearchUrl();
|
||||
resultContainer.find("div.summary-table").remove();
|
||||
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
|
||||
button.siblings().removeClass("active-table-tab");
|
||||
button.addClass("active-table-tab");
|
||||
}
|
||||
}
|
||||
function selectTab(category) {
|
||||
$("button#result-tab-" + category).click();
|
||||
}
|
||||
function renderTable(category, items) {
|
||||
var table = $("<div class='summary-table'>")
|
||||
.addClass(category === "modules"
|
||||
? "one-column-search-results"
|
||||
: "two-column-search-results");
|
||||
var col1, col2;
|
||||
if (category === "modules") {
|
||||
col1 = "Module";
|
||||
} else if (category === "packages") {
|
||||
col1 = "Module";
|
||||
col2 = "Package";
|
||||
} else if (category === "types") {
|
||||
col1 = "Package";
|
||||
col2 = "Class"
|
||||
} else if (category === "members") {
|
||||
col1 = "Class";
|
||||
col2 = "Member";
|
||||
} else if (category === "searchTags") {
|
||||
col1 = "Location";
|
||||
col2 = "Name";
|
||||
}
|
||||
$("<div class='table-header col-plain'>" + col1 + "</div>").appendTo(table);
|
||||
if (category !== "modules") {
|
||||
$("<div class='table-header col-plain'>" + col2 + "</div>").appendTo(table);
|
||||
}
|
||||
$.each(items, function(index, item) {
|
||||
var rowColor = index % 2 ? "odd-row-color" : "even-row-color";
|
||||
renderItem(item, table, rowColor);
|
||||
});
|
||||
return table;
|
||||
}
|
||||
function renderItem(item, table, rowColor) {
|
||||
var label = getHighlightedText(item.input, item.boundaries, item.prefix.length, item.input.length);
|
||||
var link = $("<a/>")
|
||||
.attr("href", getURL(item.indexItem, item.category))
|
||||
.attr("tabindex", "0")
|
||||
.addClass("search-result-link")
|
||||
.html(label);
|
||||
var container = getHighlightedText(item.input, item.boundaries, 0, item.prefix.length - 1);
|
||||
if (item.category === "searchTags") {
|
||||
container = item.indexItem.h || "";
|
||||
}
|
||||
if (item.category !== "modules") {
|
||||
$("<div/>").html(container).addClass("col-plain").addClass(rowColor).appendTo(table);
|
||||
}
|
||||
$("<div/>").html(link).addClass("col-last").addClass(rowColor).appendTo(table);
|
||||
}
|
||||
var timeout;
|
||||
function schedulePageSearch() {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
timeout = setTimeout(function () {
|
||||
doPageSearch()
|
||||
}, 100);
|
||||
}
|
||||
function doPageSearch() {
|
||||
setSearchUrl();
|
||||
var term = searchTerm = input.val().trim();
|
||||
if (term === "") {
|
||||
notify.html(messages.enterTerm);
|
||||
activeTab = "";
|
||||
fixedTab = false;
|
||||
resultContainer.empty();
|
||||
resultSection.hide();
|
||||
} else {
|
||||
notify.html(messages.searching);
|
||||
doSearch({ term: term, maxResults: 1200 }, renderResults);
|
||||
}
|
||||
}
|
||||
function setSearchUrl() {
|
||||
var query = input.val().trim();
|
||||
var url = document.location.pathname;
|
||||
if (query) {
|
||||
url += "?q=" + encodeURI(query);
|
||||
if (activeTab && fixedTab) {
|
||||
url += "&c=" + activeTab;
|
||||
}
|
||||
}
|
||||
history.replaceState({query: query}, "", url);
|
||||
}
|
||||
input.on("input", function(e) {
|
||||
feelingLucky = false;
|
||||
schedulePageSearch();
|
||||
});
|
||||
$(document).keydown(function(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
||||
if (activeTab && visibleTabs.length > 1) {
|
||||
var idx = visibleTabs.indexOf(activeTab);
|
||||
idx += e.key === "ArrowLeft" ? visibleTabs.length - 1 : 1;
|
||||
selectTab(visibleTabs[idx % visibleTabs.length]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
reset.click(function() {
|
||||
notify.html(messages.enterTerm);
|
||||
resultSection.hide();
|
||||
activeTab = "";
|
||||
fixedTab = false;
|
||||
resultContainer.empty();
|
||||
input.val('').focus();
|
||||
setSearchUrl();
|
||||
});
|
||||
input.prop("disabled", false);
|
||||
input.attr("autocapitalize", "off");
|
||||
reset.prop("disabled", false);
|
||||
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has("q")) {
|
||||
input.val(urlParams.get("q"))
|
||||
}
|
||||
if (urlParams.has("c")) {
|
||||
activeTab = urlParams.get("c");
|
||||
fixedTab = true;
|
||||
}
|
||||
if (urlParams.get("r")) {
|
||||
feelingLucky = true;
|
||||
}
|
||||
if (input.val()) {
|
||||
doPageSearch();
|
||||
} else {
|
||||
notify.html(messages.enterTerm);
|
||||
}
|
||||
input.select().focus();
|
||||
});
|
||||
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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/
|
||||
*/
|
||||
"use strict";
|
||||
const messages = {
|
||||
enterTerm: "Enter a search term",
|
||||
noResult: "No results found",
|
||||
oneResult: "Found one result",
|
||||
manyResults: "Found {0} results",
|
||||
loading: "Loading search index...",
|
||||
searching: "Searching...",
|
||||
redirecting: "Redirecting to first result...",
|
||||
}
|
||||
const categories = {
|
||||
modules: "Modules",
|
||||
packages: "Packages",
|
||||
types: "Classes and Interfaces",
|
||||
members: "Members",
|
||||
searchTags: "Search Tags"
|
||||
};
|
||||
const highlight = "<span class='result-highlight'>$&</span>";
|
||||
const NO_MATCH = {};
|
||||
const MAX_RESULTS = 300;
|
||||
const UNICODE_LETTER = 0;
|
||||
const UNICODE_DIGIT = 1;
|
||||
const UNICODE_OTHER = 2;
|
||||
function checkUnnamed(name, separator) {
|
||||
return name === "<Unnamed>" || !name ? "" : name + separator;
|
||||
}
|
||||
function escapeHtml(str) {
|
||||
return str.replace(/</g, "<").replace(/>/g, ">");
|
||||
}
|
||||
function getHighlightedText(str, boundaries, from, to) {
|
||||
var start = from;
|
||||
var text = "";
|
||||
for (var i = 0; i < boundaries.length; i += 2) {
|
||||
var b0 = boundaries[i];
|
||||
var b1 = boundaries[i + 1];
|
||||
if (b0 >= to || b1 <= from) {
|
||||
continue;
|
||||
}
|
||||
text += escapeHtml(str.slice(start, Math.max(start, b0)));
|
||||
text += "<span class='result-highlight'>";
|
||||
text += escapeHtml(str.slice(Math.max(start, b0), Math.min(to, b1)));
|
||||
text += "</span>";
|
||||
start = Math.min(to, b1);
|
||||
}
|
||||
text += escapeHtml(str.slice(start, to));
|
||||
return text;
|
||||
}
|
||||
function getURLPrefix(item, category) {
|
||||
var urlPrefix = "";
|
||||
var slash = "/";
|
||||
if (category === "modules") {
|
||||
return item.l + slash;
|
||||
} else if (category === "packages" && item.m) {
|
||||
return item.m + slash;
|
||||
} else if (category === "types" || category === "members") {
|
||||
if (item.m) {
|
||||
urlPrefix = item.m + slash;
|
||||
} else {
|
||||
$.each(packageSearchIndex, function(index, it) {
|
||||
if (it.m && item.p === it.l) {
|
||||
urlPrefix = it.m + slash;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return urlPrefix;
|
||||
}
|
||||
function getURL(item, category) {
|
||||
if (item.url) {
|
||||
return item.url;
|
||||
}
|
||||
var url = getURLPrefix(item, category);
|
||||
if (category === "modules") {
|
||||
url += "module-summary.html";
|
||||
} else if (category === "packages") {
|
||||
if (item.u) {
|
||||
url = item.u;
|
||||
} else {
|
||||
url += item.l.replace(/\./g, '/') + "/package-summary.html";
|
||||
}
|
||||
} else if (category === "types") {
|
||||
if (item.u) {
|
||||
url = item.u;
|
||||
} else {
|
||||
url += checkUnnamed(item.p, "/").replace(/\./g, '/') + item.l + ".html";
|
||||
}
|
||||
} else if (category === "members") {
|
||||
url += checkUnnamed(item.p, "/").replace(/\./g, '/') + item.c + ".html" + "#";
|
||||
if (item.u) {
|
||||
url += item.u;
|
||||
} else {
|
||||
url += item.l;
|
||||
}
|
||||
} else if (category === "searchTags") {
|
||||
url += item.u;
|
||||
}
|
||||
item.url = url;
|
||||
return url;
|
||||
}
|
||||
function createMatcher(term, camelCase) {
|
||||
if (camelCase && !isUpperCase(term)) {
|
||||
return null; // no need for camel-case matcher for lower case query
|
||||
}
|
||||
var pattern = "";
|
||||
var upperCase = [];
|
||||
term.trim().split(/\s+/).forEach(function(w, index, array) {
|
||||
var tokens = w.split(/(?=[\p{Lu},.()<>?[\/])/u);
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var s = tokens[i];
|
||||
// ',' and '?' are the only delimiters commonly followed by space in java signatures
|
||||
pattern += "(" + escapeUnicodeRegex(s).replace(/[,?]/g, "$&\\s*?") + ")";
|
||||
upperCase.push(false);
|
||||
var isWordToken = /[\p{L}\p{Nd}_]$/u.test(s);
|
||||
if (isWordToken) {
|
||||
if (i === tokens.length - 1 && index < array.length - 1) {
|
||||
// space in query string matches all delimiters
|
||||
pattern += "(.*?)";
|
||||
upperCase.push(isUpperCase(s[0]));
|
||||
} else {
|
||||
if (!camelCase && isUpperCase(s) && s.length === 1) {
|
||||
pattern += "()";
|
||||
} else {
|
||||
pattern += "([\\p{L}\\p{Nd}\\p{Sc}<>?[\\]]*?)";
|
||||
}
|
||||
upperCase.push(isUpperCase(s[0]));
|
||||
}
|
||||
} else {
|
||||
pattern += "()";
|
||||
upperCase.push(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
var re = new RegExp(pattern, "gui");
|
||||
re.upperCase = upperCase;
|
||||
return re;
|
||||
}
|
||||
// Unicode regular expressions do not allow certain characters to be escaped
|
||||
function escapeUnicodeRegex(pattern) {
|
||||
return pattern.replace(/[\[\]{}()*+?.\\^$|\s]/g, '\\$&');
|
||||
}
|
||||
function findMatch(matcher, input, startOfName, endOfName) {
|
||||
var from = startOfName;
|
||||
matcher.lastIndex = from;
|
||||
var match = matcher.exec(input);
|
||||
// Expand search area until we get a valid result or reach the beginning of the string
|
||||
while (!match || match.index + match[0].length < startOfName || endOfName < match.index) {
|
||||
if (from === 0) {
|
||||
return NO_MATCH;
|
||||
}
|
||||
from = input.lastIndexOf(".", from - 2) + 1;
|
||||
matcher.lastIndex = from;
|
||||
match = matcher.exec(input);
|
||||
}
|
||||
var boundaries = [];
|
||||
var matchEnd = match.index + match[0].length;
|
||||
var score = 5;
|
||||
var start = match.index;
|
||||
var prevEnd = -1;
|
||||
for (var i = 1; i < match.length; i += 2) {
|
||||
var charType = getCharType(input[start]);
|
||||
var isMatcherUpper = matcher.upperCase[i];
|
||||
// capturing groups come in pairs, match and non-match
|
||||
boundaries.push(start, start + match[i].length);
|
||||
// make sure groups are anchored on a left word boundary
|
||||
var prevChar = input[start - 1] || "";
|
||||
var nextChar = input[start + 1] || "";
|
||||
if (start !== 0) {
|
||||
if (charType === UNICODE_DIGIT && getCharType(prevChar) === UNICODE_DIGIT) {
|
||||
return NO_MATCH;
|
||||
} else if (charType === UNICODE_LETTER && getCharType(prevChar) === UNICODE_LETTER) {
|
||||
var isUpper = isUpperCase(input[start]);
|
||||
if (isUpper && (isLowerCase(prevChar) || isLowerCase(nextChar))) {
|
||||
score -= 0.1;
|
||||
} else if (isMatcherUpper && start === prevEnd) {
|
||||
score -= isUpper ? 0.1 : 1.0;
|
||||
} else {
|
||||
return NO_MATCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevEnd = start + match[i].length;
|
||||
start += match[i].length + match[i + 1].length;
|
||||
|
||||
// lower score for parts of the name that are missing
|
||||
if (match[i + 1] && prevEnd < endOfName) {
|
||||
score -= rateNoise(match[i + 1]);
|
||||
}
|
||||
}
|
||||
// lower score if a type name contains unmatched camel-case parts
|
||||
if (input[matchEnd - 1] !== "." && endOfName > matchEnd)
|
||||
score -= rateNoise(input.slice(matchEnd, endOfName));
|
||||
score -= rateNoise(input.slice(0, Math.max(startOfName, match.index)));
|
||||
|
||||
if (score <= 0) {
|
||||
return NO_MATCH;
|
||||
}
|
||||
return {
|
||||
input: input,
|
||||
score: score,
|
||||
boundaries: boundaries
|
||||
};
|
||||
}
|
||||
function isLetter(s) {
|
||||
return /\p{L}/u.test(s);
|
||||
}
|
||||
function isUpperCase(s) {
|
||||
return /\p{Lu}/u.test(s);
|
||||
}
|
||||
function isLowerCase(s) {
|
||||
return /\p{Ll}/u.test(s);
|
||||
}
|
||||
function isDigit(s) {
|
||||
return /\p{Nd}/u.test(s);
|
||||
}
|
||||
function getCharType(s) {
|
||||
if (isLetter(s)) {
|
||||
return UNICODE_LETTER;
|
||||
} else if (isDigit(s)) {
|
||||
return UNICODE_DIGIT;
|
||||
} else {
|
||||
return UNICODE_OTHER;
|
||||
}
|
||||
}
|
||||
function rateNoise(str) {
|
||||
return (str.match(/([.(])/g) || []).length / 5
|
||||
+ (str.match(/(\p{Lu}+)/gu) || []).length / 10
|
||||
+ str.length / 20;
|
||||
}
|
||||
function doSearch(request, response) {
|
||||
var term = request.term.trim();
|
||||
var maxResults = request.maxResults || MAX_RESULTS;
|
||||
var matcher = {
|
||||
plainMatcher: createMatcher(term, false),
|
||||
camelCaseMatcher: createMatcher(term, true)
|
||||
}
|
||||
var indexLoaded = indexFilesLoaded();
|
||||
|
||||
function getPrefix(item, category) {
|
||||
switch (category) {
|
||||
case "packages":
|
||||
return checkUnnamed(item.m, "/");
|
||||
case "types":
|
||||
return checkUnnamed(item.p, ".");
|
||||
case "members":
|
||||
return checkUnnamed(item.p, ".") + item.c + ".";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function useQualifiedName(category) {
|
||||
switch (category) {
|
||||
case "packages":
|
||||
return /[\s/]/.test(term);
|
||||
case "types":
|
||||
case "members":
|
||||
return /[\s.]/.test(term);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function searchIndex(indexArray, category) {
|
||||
var matches = [];
|
||||
if (!indexArray) {
|
||||
if (!indexLoaded) {
|
||||
matches.push({ l: messages.loading, category: category });
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
$.each(indexArray, function (i, item) {
|
||||
var prefix = getPrefix(item, category);
|
||||
var simpleName = item.l;
|
||||
var qualifiedName = prefix + simpleName;
|
||||
var useQualified = useQualifiedName(category);
|
||||
var input = useQualified ? qualifiedName : simpleName;
|
||||
var startOfName = useQualified ? prefix.length : 0;
|
||||
var endOfName = category === "members" && input.indexOf("(", startOfName) > -1
|
||||
? input.indexOf("(", startOfName) : input.length;
|
||||
var m = findMatch(matcher.plainMatcher, input, startOfName, endOfName);
|
||||
if (m === NO_MATCH && matcher.camelCaseMatcher) {
|
||||
m = findMatch(matcher.camelCaseMatcher, input, startOfName, endOfName);
|
||||
}
|
||||
if (m !== NO_MATCH) {
|
||||
m.indexItem = item;
|
||||
m.prefix = prefix;
|
||||
m.category = category;
|
||||
if (!useQualified) {
|
||||
m.input = qualifiedName;
|
||||
m.boundaries = m.boundaries.map(function(b) {
|
||||
return b + prefix.length;
|
||||
});
|
||||
}
|
||||
matches.push(m);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return matches.sort(function(e1, e2) {
|
||||
return e2.score - e1.score;
|
||||
}).slice(0, maxResults);
|
||||
}
|
||||
|
||||
var result = searchIndex(moduleSearchIndex, "modules")
|
||||
.concat(searchIndex(packageSearchIndex, "packages"))
|
||||
.concat(searchIndex(typeSearchIndex, "types"))
|
||||
.concat(searchIndex(memberSearchIndex, "members"))
|
||||
.concat(searchIndex(tagSearchIndex, "searchTags"));
|
||||
|
||||
if (!indexLoaded) {
|
||||
updateSearchResults = function() {
|
||||
doSearch(request, response);
|
||||
}
|
||||
} else {
|
||||
updateSearchResults = function() {};
|
||||
}
|
||||
response(result);
|
||||
}
|
||||
// JQuery search menu implementation
|
||||
$.widget("custom.catcomplete", $.ui.autocomplete, {
|
||||
_create: function() {
|
||||
this._super();
|
||||
this.widget().menu("option", "items", "> .result-item");
|
||||
// workaround for search result scrolling
|
||||
this.menu._scrollIntoView = function _scrollIntoView( item ) {
|
||||
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
|
||||
if ( this._hasScroll() ) {
|
||||
borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
|
||||
paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
|
||||
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
|
||||
scroll = this.activeMenu.scrollTop();
|
||||
elementHeight = this.activeMenu.height() - 26;
|
||||
itemHeight = item.outerHeight();
|
||||
|
||||
if ( offset < 0 ) {
|
||||
this.activeMenu.scrollTop( scroll + offset );
|
||||
} else if ( offset + itemHeight > elementHeight ) {
|
||||
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
_renderMenu: function(ul, items) {
|
||||
var currentCategory = "";
|
||||
var widget = this;
|
||||
widget.menu.bindings = $();
|
||||
$.each(items, function(index, item) {
|
||||
if (item.category && item.category !== currentCategory) {
|
||||
ul.append("<li class='ui-autocomplete-category'>" + categories[item.category] + "</li>");
|
||||
currentCategory = item.category;
|
||||
}
|
||||
var li = widget._renderItemData(ul, item);
|
||||
if (item.category) {
|
||||
li.attr("aria-label", categories[item.category] + " : " + item.l);
|
||||
} else {
|
||||
li.attr("aria-label", item.l);
|
||||
}
|
||||
li.attr("class", "result-item");
|
||||
});
|
||||
ul.append("<li class='ui-static-link'><a href='" + pathtoroot + "search.html?q="
|
||||
+ encodeURI(widget.term) + "'>Go to search page</a></li>");
|
||||
},
|
||||
_renderItem: function(ul, item) {
|
||||
var li = $("<li/>").appendTo(ul);
|
||||
var div = $("<div/>").appendTo(li);
|
||||
var label = item.l
|
||||
? item.l
|
||||
: getHighlightedText(item.input, item.boundaries, 0, item.input.length);
|
||||
var idx = item.indexItem;
|
||||
if (item.category === "searchTags" && idx && idx.h) {
|
||||
if (idx.d) {
|
||||
div.html(label + "<span class='search-tag-holder-result'> (" + idx.h + ")</span><br><span class='search-tag-desc-result'>"
|
||||
+ idx.d + "</span><br>");
|
||||
} else {
|
||||
div.html(label + "<span class='search-tag-holder-result'> (" + idx.h + ")</span>");
|
||||
}
|
||||
} else {
|
||||
div.html(label);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
});
|
||||
$(function() {
|
||||
var search = $("#search-input");
|
||||
var reset = $("#reset-search");
|
||||
search.catcomplete({
|
||||
minLength: 1,
|
||||
delay: 200,
|
||||
source: function(request, response) {
|
||||
reset.css("display", "inline");
|
||||
if (request.term.trim() === "") {
|
||||
return this.close();
|
||||
}
|
||||
return doSearch(request, response);
|
||||
},
|
||||
response: function(event, ui) {
|
||||
if (!ui.content.length) {
|
||||
ui.content.push({ l: messages.noResult });
|
||||
} else {
|
||||
$("#search-input").empty();
|
||||
}
|
||||
},
|
||||
close: function(event, ui) {
|
||||
reset.css("display", search.val() ? "inline" : "none");
|
||||
},
|
||||
change: function(event, ui) {
|
||||
reset.css("display", search.val() ? "inline" : "none");
|
||||
},
|
||||
autoFocus: true,
|
||||
focus: function(event, ui) {
|
||||
return false;
|
||||
},
|
||||
position: {
|
||||
collision: "flip"
|
||||
},
|
||||
select: function(event, ui) {
|
||||
if (ui.item.indexItem) {
|
||||
var url = getURL(ui.item.indexItem, ui.item.category);
|
||||
window.location.href = pathtoroot + url;
|
||||
$("#search-input").focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
search.val('');
|
||||
search.prop("disabled", false);
|
||||
search.attr("autocapitalize", "off");
|
||||
reset.prop("disabled", false);
|
||||
reset.click(function() {
|
||||
search.val('').focus();
|
||||
reset.css("display", "none");
|
||||
});
|
||||
search.focus();
|
||||
});
|
||||
Reference in new issue
Block a user