mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-21 12:20:29 +00:00
8378228: Replace jQuery UI autocomplete component in JavaDoc search
Reviewed-by: nbenalla
This commit is contained in:
parent
d75bb86ca6
commit
6371da9a44
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -335,16 +335,9 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
|
||||
if (options.createIndex()) {
|
||||
copyResource(DocPaths.SEARCH_JS_TEMPLATE, DocPaths.SCRIPT_FILES.resolve(DocPaths.SEARCH_JS), true);
|
||||
copyResource(DocPaths.SEARCH_PAGE_JS, DocPaths.SCRIPT_FILES.resolve(DocPaths.SEARCH_PAGE_JS), true);
|
||||
copyResource(DocPaths.GLASS_SVG, DocPaths.RESOURCE_FILES.resolve(DocPaths.GLASS_SVG), false);
|
||||
copyResource(DocPaths.X_SVG, DocPaths.RESOURCE_FILES.resolve(DocPaths.X_SVG), false);
|
||||
// No newline replacement for JQuery files
|
||||
copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_JS),
|
||||
DocPaths.SCRIPT_FILES.resolve(DocPaths.JQUERY_JS), false);
|
||||
copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_UI_JS),
|
||||
DocPaths.SCRIPT_FILES.resolve(DocPaths.JQUERY_UI_JS), false);
|
||||
copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_UI_CSS),
|
||||
DocPaths.RESOURCE_FILES.resolve(DocPaths.JQUERY_UI_CSS), false); }
|
||||
}
|
||||
|
||||
copyLegalFiles(options.createIndex(), options.syntaxHighlight());
|
||||
// Print a notice if the documentation contains diagnostic markers
|
||||
@ -369,7 +362,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
case "", "default" -> {
|
||||
// use a known resource as a stand-in, because we cannot get the URL for a resources directory
|
||||
var url = HtmlDoclet.class.getResource(
|
||||
DocPaths.RESOURCES.resolve(DocPaths.LEGAL).resolve(DocPaths.JQUERY_MD).getPath());
|
||||
DocPaths.RESOURCES.resolve(DocPaths.LEGAL).resolve(DocPaths.DEJAVU_MD).getPath());
|
||||
if (url != null) {
|
||||
try {
|
||||
legalNoticesDir = Path.of(url.toURI()).getParent();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -112,6 +112,11 @@ public class HtmlIds {
|
||||
static final HtmlId RELATED_PACKAGE_SUMMARY = HtmlId.of("related-package-summary");
|
||||
static final HtmlId RESET_SEARCH = HtmlId.of("reset-search");
|
||||
static final HtmlId SEARCH_INPUT = HtmlId.of("search-input");
|
||||
static final HtmlId SEARCH_INPUT_CONTAINER = HtmlId.of("search-input-container");
|
||||
static final HtmlId SEARCH_MODULES = HtmlId.of("search-modules");
|
||||
static final HtmlId SEARCH_PAGE_LINK = HtmlId.of("search-page-link");
|
||||
static final HtmlId SEARCH_RESULT_CONTAINER = HtmlId.of("search-result-container");
|
||||
static final HtmlId SEARCH_RESULT_SECTION = HtmlId.of("search-result-section");
|
||||
static final HtmlId SERVICES = HtmlId.of("services-summary");
|
||||
static final HtmlId SKIP_NAVBAR_TOP = HtmlId.of("skip-navbar-top");
|
||||
static final HtmlId THEME_BUTTON = HtmlId.of("theme-button");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -45,6 +45,8 @@ import jdk.javadoc.internal.html.Content;
|
||||
import jdk.javadoc.internal.html.ContentBuilder;
|
||||
import jdk.javadoc.internal.html.Entity;
|
||||
import jdk.javadoc.internal.html.HtmlAttr;
|
||||
import jdk.javadoc.internal.html.HtmlId;
|
||||
import jdk.javadoc.internal.html.HtmlTag;
|
||||
import jdk.javadoc.internal.html.HtmlTree;
|
||||
import jdk.javadoc.internal.html.Text;
|
||||
|
||||
@ -535,6 +537,42 @@ public class Navigation {
|
||||
.add(inputText)
|
||||
.add(inputReset);
|
||||
target.add(searchDiv);
|
||||
target.add(HtmlTree.DIV(HtmlIds.SEARCH_RESULT_SECTION)
|
||||
.add(HtmlTree.DIV(HtmlStyles.searchForm)
|
||||
.add(HtmlTree.DIV(HtmlTree.LABEL(HtmlIds.SEARCH_INPUT.name(),
|
||||
contents.getContent("doclet.search.for"))))
|
||||
.add(HtmlTree.DIV(HtmlIds.SEARCH_INPUT_CONTAINER).addUnchecked(Text.EMPTY))
|
||||
.add(createModuleSelector()))
|
||||
.add(HtmlTree.DIV(HtmlIds.SEARCH_RESULT_CONTAINER).addUnchecked(Text.EMPTY))
|
||||
.add(HtmlTree.DIV(HtmlStyles.searchLinks)
|
||||
.add(HtmlTree.DIV(links.createLink(pathToRoot.resolve(DocPaths.SEARCH_PAGE),
|
||||
contents.getContent("doclet.search.linkSearchPageLabel"))
|
||||
.setId(HtmlIds.SEARCH_PAGE_LINK)))
|
||||
.add(options.noHelp() || !options.helpFile().isEmpty()
|
||||
? HtmlTree.DIV(Text.EMPTY).addUnchecked(Text.EMPTY)
|
||||
: HtmlTree.DIV(links.createLink(pathToRoot.resolve(DocPaths.HELP_DOC).fragment("search"),
|
||||
contents.getContent("doclet.search.linkSearchHelpLabel"))))));
|
||||
}
|
||||
|
||||
private Content createModuleSelector() {
|
||||
if (!configuration.showModules || configuration.modules.size() < 2) {
|
||||
return Text.EMPTY;
|
||||
}
|
||||
var content = new ContentBuilder(HtmlTree.DIV(HtmlTree.LABEL(HtmlIds.SEARCH_MODULES.name(),
|
||||
contents.getContent("doclet.search.in_modules"))));
|
||||
var select = HtmlTree.of(HtmlTag.SELECT)
|
||||
.setId(HtmlIds.SEARCH_MODULES)
|
||||
.put(HtmlAttr.ARIA_LABEL, configuration.getDocResources().getText("doclet.selectModule"))
|
||||
.add(HtmlTree.of(HtmlTag.OPTION)
|
||||
.put(HtmlAttr.VALUE, "")
|
||||
.add(contents.getContent("doclet.search.all_modules")));
|
||||
|
||||
for (ModuleElement module : configuration.modules) {
|
||||
select.add(HtmlTree.of(HtmlTag.OPTION)
|
||||
.put(HtmlAttr.VALUE, module.getQualifiedName().toString())
|
||||
.add(Text.of(module.getQualifiedName().toString())));
|
||||
}
|
||||
return content.add(HtmlTree.DIV(select));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,17 +92,15 @@ public class SearchWriter extends HtmlDocletWriter {
|
||||
.add(resourceSection)
|
||||
.add(HtmlTree.P(contents.getContent("doclet.search.loading"))
|
||||
.setId(HtmlId.of("page-search-notify")))
|
||||
.add(HtmlTree.DIV(HtmlTree.DIV(HtmlId.of("result-container"))
|
||||
.add(HtmlTree.DIV(HtmlTree.DIV(HtmlIds.SEARCH_RESULT_CONTAINER)
|
||||
.addUnchecked(Text.EMPTY))
|
||||
.setId(HtmlId.of("result-section"))
|
||||
.put(HtmlAttr.STYLE, "display: none;")
|
||||
.add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.SCRIPT_FILES)
|
||||
.resolve(DocPaths.SEARCH_PAGE_JS).getPath())));
|
||||
.setId(HtmlIds.SEARCH_RESULT_SECTION)
|
||||
.put(HtmlAttr.STYLE, "display: none;"));
|
||||
}
|
||||
|
||||
private Content createModuleSelector() {
|
||||
|
||||
if (!configuration.showModules) {
|
||||
if (!configuration.showModules || configuration.modules.size() < 2) {
|
||||
return Text.EMPTY;
|
||||
}
|
||||
|
||||
@ -118,7 +116,7 @@ public class SearchWriter extends HtmlDocletWriter {
|
||||
.put(HtmlAttr.VALUE, module.getQualifiedName().toString())
|
||||
.add(Text.of(module.getQualifiedName().toString())));
|
||||
}
|
||||
return new ContentBuilder(contents.getContent("doclet.search.in", select));
|
||||
return new ContentBuilder(contents.getContent("doclet.search.in_modules"), select);
|
||||
}
|
||||
|
||||
private Content createResourceSection() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -336,11 +336,6 @@ public class Head extends Content {
|
||||
}
|
||||
|
||||
private void addStylesheets(HtmlTree head) {
|
||||
if (index) {
|
||||
// Add JQuery-UI stylesheet first so its rules can be overridden.
|
||||
addStylesheet(head, DocPaths.RESOURCE_FILES.resolve(DocPaths.JQUERY_UI_CSS));
|
||||
}
|
||||
|
||||
if (mainStylesheet == null) {
|
||||
mainStylesheet = DocPaths.STYLESHEET;
|
||||
}
|
||||
@ -381,8 +376,6 @@ public class Head extends Content {
|
||||
.append("loadScripts();\n")
|
||||
.append("initTheme();\n");
|
||||
}
|
||||
addScriptElement(head, DocPaths.JQUERY_JS);
|
||||
addScriptElement(head, DocPaths.JQUERY_UI_JS);
|
||||
}
|
||||
for (HtmlConfiguration.JavaScriptFile javaScriptFile : additionalScripts) {
|
||||
addScriptElement(head, javaScriptFile);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -734,6 +734,16 @@ public enum HtmlStyles implements HtmlStyle {
|
||||
*/
|
||||
pageSearchInfo,
|
||||
|
||||
/**
|
||||
* The class for a {@code div} element in the search widget containing the search form inputs.
|
||||
*/
|
||||
searchForm,
|
||||
|
||||
/**
|
||||
* The class for a {@code div} element in the search widget containing search-related links.
|
||||
*/
|
||||
searchLinks,
|
||||
|
||||
/**
|
||||
* The class for a link in the static "Index" pages to a custom searchable item,
|
||||
* such as defined with an {@code @index} tag.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,148 +0,0 @@
|
||||
/*! jQuery UI - v1.14.1 - 2025-01-13
|
||||
* https://jqueryui.com
|
||||
* Includes: core.css, autocomplete.css, menu.css
|
||||
* Copyright OpenJS Foundation and other contributors; Licensed MIT */
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden {
|
||||
display: none;
|
||||
}
|
||||
.ui-helper-hidden-accessible {
|
||||
border: 0;
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
.ui-helper-reset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
line-height: 1.3;
|
||||
text-decoration: none;
|
||||
font-size: 100%;
|
||||
list-style: none;
|
||||
}
|
||||
.ui-helper-clearfix:before,
|
||||
.ui-helper-clearfix:after {
|
||||
content: "";
|
||||
display: table;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.ui-helper-clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
.ui-helper-zfix {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.ui-front {
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-disabled {
|
||||
cursor: default !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
.ui-icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-top: -.25em;
|
||||
position: relative;
|
||||
text-indent: -99999px;
|
||||
overflow: hidden;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.ui-widget-icon-block {
|
||||
left: 50%;
|
||||
margin-left: -8px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.ui-autocomplete {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: default;
|
||||
}
|
||||
.ui-menu {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: block;
|
||||
outline: 0;
|
||||
}
|
||||
.ui-menu .ui-menu {
|
||||
position: absolute;
|
||||
}
|
||||
.ui-menu .ui-menu-item {
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ui-menu .ui-menu-item-wrapper {
|
||||
position: relative;
|
||||
padding: 3px 1em 3px .4em;
|
||||
}
|
||||
.ui-menu .ui-menu-divider {
|
||||
margin: 5px 0;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
.ui-menu .ui-state-focus,
|
||||
.ui-menu .ui-state-active {
|
||||
margin: -1px;
|
||||
}
|
||||
|
||||
/* icon support */
|
||||
.ui-menu-icons {
|
||||
position: relative;
|
||||
}
|
||||
.ui-menu-icons .ui-menu-item-wrapper {
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
/* left-aligned */
|
||||
.ui-menu .ui-icon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: .2em;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
/* right-aligned */
|
||||
.ui-menu .ui-menu-icon {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
/*! jQuery UI - v1.14.1 - 2025-01-13
|
||||
* https://jqueryui.com
|
||||
* Includes: core.css, autocomplete.css, menu.css
|
||||
* Copyright OpenJS Foundation and other contributors; Licensed MIT */
|
||||
|
||||
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}
|
||||
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2026, 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/
|
||||
@ -447,18 +447,12 @@ document.addEventListener("DOMContentLoaded", function(e) {
|
||||
e.preventDefault();
|
||||
} else if (e.key === "Escape") {
|
||||
closeThemePanel();
|
||||
if (expanded) {
|
||||
var filter = getVisibleFilterInput(false);
|
||||
if (e.target === filter) {
|
||||
resetInput(filter, e, true);
|
||||
} else if (expanded) {
|
||||
collapse();
|
||||
e.preventDefault();
|
||||
} else if (e.target.id === "page-search-input") {
|
||||
resetInput(e.target, e, false);
|
||||
} else if (isInput(e.target)) {
|
||||
resetInput(e.target, e, true);
|
||||
} else {
|
||||
var filter = getVisibleFilterInput(false);
|
||||
if (filter && filter.value) {
|
||||
resetInput(filterInput, e, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,348 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2025, 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.on("click", copyLink);
|
||||
copy[0].onmouseenter = function() {};
|
||||
redirect.on("click", setSearchUrlTemplate);
|
||||
setSearchUrlTemplate();
|
||||
copy.prop("disabled", false);
|
||||
redirect.prop("disabled", false);
|
||||
expand.on("click", function (e) {
|
||||
var searchInfo = $("div.page-search-info");
|
||||
if(this.parentElement.hasAttribute("open")) {
|
||||
searchInfo.attr("style", " display:none;");
|
||||
} else {
|
||||
searchInfo.attr("style", "display:block;");
|
||||
}
|
||||
});
|
||||
});
|
||||
$(window).on("load", function() {
|
||||
var input = $("#page-search-input");
|
||||
var reset = $("#page-search-reset");
|
||||
var modules = $("#search-modules");
|
||||
var notify = $("#page-search-notify");
|
||||
var resultSection = $("div#result-section");
|
||||
var resultContainer = $("div#result-container");
|
||||
var selectedLink;
|
||||
var searchTerm = "";
|
||||
var activeTab = "";
|
||||
var fixedTab = false;
|
||||
var visibleTabs = [];
|
||||
var feelingLucky = false;
|
||||
const MIN_TABBED_RESULTS = 10;
|
||||
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) {
|
||||
activeTab = Object.keys(r).find(category => r[category].length > 0);
|
||||
}
|
||||
if (feelingLucky && activeTab) {
|
||||
notify.html(messages.redirecting)
|
||||
var firstItem = r[activeTab][0];
|
||||
window.location = getURL(firstItem.indexItem, firstItem.category);
|
||||
return;
|
||||
}
|
||||
if (searchTerm.endsWith(".") && result.length > MIN_TABBED_RESULTS) {
|
||||
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 > MIN_TABBED_RESULTS && categoryCount > 1) {
|
||||
let button = $("<button/>")
|
||||
.attr("id", "result-tab-" + key)
|
||||
.attr("tabIndex", "-1")
|
||||
.addClass("page-search-header")
|
||||
.append($("<span/>")
|
||||
.html(categories[key])
|
||||
.append($("<span/>")
|
||||
.attr("style", "font-weight:normal;")
|
||||
.html(" (" + count + ")")))
|
||||
.on("click", null, key, function(e) {
|
||||
fixedTab = true;
|
||||
renderResult(e.data, $(this));
|
||||
}).appendTo(tabContainer);
|
||||
visibleTabs.push(key);
|
||||
} else {
|
||||
$("<span class='page-search-header'>" + 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 > MIN_TABBED_RESULTS && categoryCount > 1) {
|
||||
$("button#result-tab-" + activeTab).addClass("active-table-tab").attr("tabIndex", "0");
|
||||
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
|
||||
}
|
||||
resultSection.show();
|
||||
function renderResult(category, button) {
|
||||
activeTab = category;
|
||||
setSearchUrl();
|
||||
resultContainer.find("div.result-table").remove();
|
||||
renderTable(activeTab, r[activeTab]).appendTo(resultContainer);
|
||||
button.siblings().removeClass("active-table-tab").attr("tabIndex", "-1");
|
||||
button.addClass("active-table-tab").attr("tabIndex", "0");
|
||||
}
|
||||
}
|
||||
function selectTab(category) {
|
||||
$("button#result-tab-" + category).focus().trigger("click");
|
||||
}
|
||||
function renderTable(category, items) {
|
||||
var table = $("<div class='result-table'>");
|
||||
var col1, col2;
|
||||
if (category === "modules") {
|
||||
col1 = mdlDesc;
|
||||
} else if (category === "packages") {
|
||||
col1 = pkgDesc;
|
||||
} else if (category === "types") {
|
||||
col1 = clsDesc;
|
||||
} else if (category === "members") {
|
||||
col1 = mbrDesc;
|
||||
} else if (category === "searchTags") {
|
||||
col1 = tagDesc;
|
||||
}
|
||||
col2 = descDesc;
|
||||
$("<div class='table-header'/>")
|
||||
.append($("<span class='table-header'/>").html(col1))
|
||||
.append($("<span class='table-header'/>").html(col2))
|
||||
.appendTo(table);
|
||||
$.each(items, function(index, item) {
|
||||
renderItem(item, table);
|
||||
});
|
||||
return table;
|
||||
}
|
||||
function select() {
|
||||
if (!this.classList.contains("selected")) {
|
||||
setSelected(this);
|
||||
}
|
||||
}
|
||||
function unselect() {
|
||||
if (this.classList.contains("selected")) {
|
||||
setSelected(null);
|
||||
}
|
||||
}
|
||||
function renderItem(item, table) {
|
||||
var label = getResultLabel(item);
|
||||
var desc = getResultDescription(item);
|
||||
var link = $("<a/>")
|
||||
.attr("href", getURL(item.indexItem, item.category))
|
||||
.attr("tabindex", "0")
|
||||
.addClass("search-result-link");
|
||||
link.on("mousemove", select.bind(link[0]))
|
||||
.on("focus", select.bind(link[0]))
|
||||
.on("mouseleave", unselect.bind(link[0]))
|
||||
.on("blur", unselect.bind(link[0]))
|
||||
.append($("<span/>").addClass("search-result-label").html(label))
|
||||
.append($("<span/>").addClass("search-result-desc").html(desc))
|
||||
.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);
|
||||
var module = modules.val();
|
||||
doSearch({ term: term, maxResults: 1200, module: module}, 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;
|
||||
}
|
||||
if (modules.val()) {
|
||||
url += "&m=" + modules.val();
|
||||
}
|
||||
}
|
||||
history.replaceState({query: query}, "", url);
|
||||
}
|
||||
input.on("input", function(e) {
|
||||
feelingLucky = false;
|
||||
reset.css("visibility", input.val() ? "visible" : "hidden");
|
||||
schedulePageSearch();
|
||||
});
|
||||
function setSelected(link) {
|
||||
if (selectedLink) {
|
||||
selectedLink.classList.remove("selected");
|
||||
selectedLink.blur();
|
||||
}
|
||||
if (link) {
|
||||
link.classList.add("selected");
|
||||
link.focus({focusVisible: true});
|
||||
}
|
||||
selectedLink = link;
|
||||
}
|
||||
document.addEventListener("keydown", e => {
|
||||
if (e.ctrlKey || e.altKey || e.metaKey) {
|
||||
return;
|
||||
}
|
||||
if (e.key === "Escape" && input.val()) {
|
||||
input.val("").focus();
|
||||
doPageSearch();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (e.target === modules[0]) {
|
||||
return;
|
||||
}
|
||||
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
||||
if (activeTab && visibleTabs.length > 1 && e.target !== input[0]) {
|
||||
var tab = visibleTabs.indexOf(activeTab);
|
||||
var newTab = e.key === "ArrowLeft"
|
||||
? Math.max(0, tab - 1)
|
||||
: Math.min(visibleTabs.length - 1, tab + 1);
|
||||
if (newTab !== tab) {
|
||||
selectTab(visibleTabs[newTab]);
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
||||
let links = Array.from(
|
||||
document.querySelectorAll("div.result-table > a.search-result-link"));
|
||||
let current = links.indexOf(selectedLink);
|
||||
let activeButton = document.querySelector("button.active-table-tab");
|
||||
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
||||
if (current > 0) {
|
||||
setSelected(links[current - 1]);
|
||||
} else {
|
||||
setSelected(null);
|
||||
if (activeButton && current === 0) {
|
||||
activeButton.focus();
|
||||
} else {
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
} else if (e.key === "ArrowDown") {
|
||||
if (document.activeElement === input[0] && activeButton) {
|
||||
activeButton.focus();
|
||||
} else if (current < links.length - 1) {
|
||||
setSelected(links[current + 1]);
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
} else if (e.key.length === 1 || e.key === "Backspace") {
|
||||
setSelected(null);
|
||||
input.focus();
|
||||
}
|
||||
});
|
||||
reset.on("click", function() {
|
||||
notify.html(messages.enterTerm);
|
||||
resultSection.hide();
|
||||
activeTab = "";
|
||||
fixedTab = false;
|
||||
resultContainer.empty();
|
||||
input.val('').focus();
|
||||
setSearchUrl();
|
||||
});
|
||||
modules.on("change", function() {
|
||||
if (input.val()) {
|
||||
doPageSearch();
|
||||
}
|
||||
input.focus();
|
||||
try {
|
||||
localStorage.setItem("search-modules", modules.val());
|
||||
} catch (unsupported) {}
|
||||
});
|
||||
|
||||
input.prop("disabled", false);
|
||||
input.attr("autocapitalize", "off");
|
||||
reset.prop("disabled", false);
|
||||
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has("m")) {
|
||||
modules.val(urlParams.get("m"));
|
||||
} else {
|
||||
try {
|
||||
var searchModules = localStorage.getItem("search-modules");
|
||||
if (searchModules) {
|
||||
modules.val(searchModules);
|
||||
}
|
||||
} catch (unsupported) {}
|
||||
}
|
||||
if (urlParams.has("q")) {
|
||||
input.val(urlParams.get("q"));
|
||||
reset.css("visibility", input.val() ? "visible" : "hidden");
|
||||
}
|
||||
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();
|
||||
});
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2026, 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/
|
||||
@ -97,13 +97,14 @@ function getURLPrefix(item, category) {
|
||||
if (item.m) {
|
||||
urlPrefix = item.m + slash;
|
||||
} else {
|
||||
$.each(packageSearchIndex, function(index, it) {
|
||||
for (var i = 0; i < packageSearchIndex.length; i++) {
|
||||
const it = packageSearchIndex[i];
|
||||
if (it.m && item.p === it.l) {
|
||||
urlPrefix = it.m + slash;
|
||||
item.m = it.m;
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return urlPrefix;
|
||||
@ -316,7 +317,7 @@ function doSearch(request, response) {
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
$.each(indexArray, function (i, item) {
|
||||
indexArray.forEach(function (item) {
|
||||
if (module) {
|
||||
var modulePrefix = getURLPrefix(item, category) || item.u;
|
||||
if (modulePrefix.indexOf("/") > -1 && !modulePrefix.startsWith(module)) {
|
||||
@ -351,7 +352,6 @@ function doSearch(request, response) {
|
||||
// m.name = m.name + " " + m.score.toFixed(3);
|
||||
matches.push(m);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return matches.sort(function(e1, e2) {
|
||||
return e2.score - e1.score
|
||||
@ -375,75 +375,6 @@ function doSearch(request, response) {
|
||||
}
|
||||
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'><div><a href='" + pathtoroot + "search.html?q="
|
||||
+ encodeURI(widget.term) + "'>" + linkLabel + "</a></div></li>");
|
||||
},
|
||||
_renderItem: function(ul, item) {
|
||||
var label = getResultLabel(item);
|
||||
var resultDesc = getResultDescription(item);
|
||||
return $("<li/>")
|
||||
.append($("<a/>")
|
||||
.attr("href", item.indexItem ? pathtoroot + getURL(item.indexItem, item.category) : null)
|
||||
.append($("<span/>").addClass("search-result-label").html(label))
|
||||
.append($("<span/>").addClass("search-result-desc").html(resultDesc)))
|
||||
.appendTo(ul);
|
||||
},
|
||||
_resizeMenu: function () {
|
||||
var ul = this.menu.element;
|
||||
var missing = 0;
|
||||
ul.children().each((i, e) => {
|
||||
if (e.hasChildNodes() && e.firstChild.hasChildNodes()) {
|
||||
var label = e.firstChild.firstChild;
|
||||
missing = Math.max(missing, label.scrollWidth - label.clientWidth);
|
||||
}
|
||||
});
|
||||
ul.outerWidth( Math.max(
|
||||
ul.width("").outerWidth() + missing + 40,
|
||||
this.element.outerWidth()
|
||||
));
|
||||
}
|
||||
});
|
||||
function getResultLabel(item) {
|
||||
if (item.l) {
|
||||
return item.l;
|
||||
@ -493,63 +424,483 @@ function getEnclosingDescription(elem, desc, label) {
|
||||
}
|
||||
function getEnclosingTypeDesc(item) {
|
||||
if (!item.typeDesc) {
|
||||
$.each(typeSearchIndex, function(index, it) {
|
||||
for (let i = 0; i < typeSearchIndex.length; i++){
|
||||
const it = typeSearchIndex[i];
|
||||
if (it.l === item.c && it.p === item.p && it.m === item.m) {
|
||||
item.typeDesc = itemDesc[it.k || 12][1];
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return item.typeDesc || "";
|
||||
}
|
||||
$(function() {
|
||||
var search = $("#search-input");
|
||||
var reset = $("#reset-search");
|
||||
search.catcomplete({
|
||||
minLength: 1,
|
||||
delay: 200,
|
||||
source: function(request, response) {
|
||||
if (request.term.trim() === "") {
|
||||
return this.close();
|
||||
}
|
||||
// Prevent selection of item at current mouse position
|
||||
this.menu.previousFilter = "_";
|
||||
this.menu.filterTimer = this.menu._delay(function() {
|
||||
delete this.previousFilter;
|
||||
}, 500);
|
||||
return doSearch(request, response);
|
||||
},
|
||||
response: function(event, ui) {
|
||||
if (!ui.content.length) {
|
||||
ui.content.push({ l: messages.noResult });
|
||||
}
|
||||
},
|
||||
autoFocus: true,
|
||||
focus: function(event, ui) {
|
||||
return false;
|
||||
},
|
||||
position: {
|
||||
collision: "flip"
|
||||
},
|
||||
select: function(event, ui) {
|
||||
for (var e = event.originalEvent; e != null; e = e.originalEvent) {
|
||||
if (e.type === "click") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ui.item.indexItem) {
|
||||
var url = getURL(ui.item.indexItem, ui.item.category);
|
||||
window.location.href = pathtoroot + url;
|
||||
search.blur();
|
||||
}
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
var copy = document.querySelector("#page-search-copy");
|
||||
if (!copy) {
|
||||
return;
|
||||
}
|
||||
var expand = document.querySelector("#page-search-expand");
|
||||
var searchLink = document.querySelector("span#page-search-link");
|
||||
var redirect = document.querySelector("input#search-redirect");
|
||||
function setSearchUrlTemplate() {
|
||||
var href = document.location.href.split(/[#?]/)[0];
|
||||
href += "?q=" + "%s";
|
||||
if (redirect.checked) {
|
||||
href += "&r=1";
|
||||
}
|
||||
searchLink.innerHTML = href;
|
||||
copy.onmouseenter();
|
||||
}
|
||||
function copyLink(e) {
|
||||
copyToClipboard(this.previousSibling.innerText);
|
||||
switchCopyLabel(this, this.lastElementChild);
|
||||
}
|
||||
copy.addEventListener("click", copyLink.bind(copy));
|
||||
copy.onmouseenter = function() {};
|
||||
redirect.addEventListener("click", setSearchUrlTemplate);
|
||||
setSearchUrlTemplate();
|
||||
copy.disabled = false;
|
||||
redirect.disabled = false;
|
||||
expand.addEventListener("click", function (e) {
|
||||
var searchInfo = document.querySelector("div.page-search-info");
|
||||
if(this.parentElement.hasAttribute("open")) {
|
||||
searchInfo.setAttribute("style", " display:none;");
|
||||
} else {
|
||||
searchInfo.setAttribute("style", "display:block;");
|
||||
}
|
||||
});
|
||||
search.val('');
|
||||
search.on("input", () => reset.css("visibility", search.val() ? "visible" : "hidden"))
|
||||
search.prop("disabled", false);
|
||||
search.attr("autocapitalize", "off");
|
||||
reset.prop("disabled", false);
|
||||
reset.click(function() {
|
||||
search.val('').focus();
|
||||
});
|
||||
});
|
||||
window.addEventListener("load", () => {
|
||||
const empty = (el) => { if (el) el.replaceChildren(); };
|
||||
const setContent = (el, text) => { if (el) el.textContent = text; };
|
||||
|
||||
const input = document.querySelector("#search-input, #page-search-input");
|
||||
const reset = document.querySelector("#reset-search, #page-search-reset");
|
||||
const modules = document.querySelector("#search-modules");
|
||||
const notify = document.querySelector("#page-search-notify");
|
||||
const resultSection = document.querySelector("#search-result-section");
|
||||
const resultContainer = document.querySelector("#search-result-container");
|
||||
|
||||
let overlay = null;
|
||||
let selectedLink = null;
|
||||
|
||||
let searchTerm = "";
|
||||
let activeTab = "";
|
||||
let fixedTab = false;
|
||||
let visibleTabs = [];
|
||||
let redirect = false;
|
||||
|
||||
const MIN_TABBED_RESULTS = 10;
|
||||
|
||||
function renderResults(result) {
|
||||
empty(resultContainer);
|
||||
|
||||
if (!result.length) {
|
||||
empty(notify);
|
||||
const p = document.createElement("p");
|
||||
p.textContent = messages.noResult;
|
||||
resultContainer.appendChild(p);
|
||||
return;
|
||||
} else if (result.length === 1) {
|
||||
setContent(notify, messages.oneResult);
|
||||
} else {
|
||||
setContent(notify, messages.manyResults.replace("{0}", String(result.length)));
|
||||
}
|
||||
|
||||
const r = { types: [], members: [], packages: [], modules: [], searchTags: [] };
|
||||
for (const item of result) (r[item.category] ??= []).push(item);
|
||||
|
||||
if (!activeTab || r[activeTab].length === 0) {
|
||||
activeTab = Object.keys(r).find(category => r[category].length > 0) || "";
|
||||
}
|
||||
|
||||
if (redirect && activeTab) {
|
||||
setContent(notify, messages.redirecting);
|
||||
const firstItem = r[activeTab][0];
|
||||
window.location = pathtoroot + getURL(firstItem.indexItem, firstItem.category);
|
||||
input.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
if (searchTerm.endsWith(".") && result.length > MIN_TABBED_RESULTS) {
|
||||
if (activeTab === "types" && r.members.length > r.types.length) {
|
||||
activeTab = "members";
|
||||
} else if (activeTab === "packages" && r.types.length > r.packages.length) {
|
||||
activeTab = "types";
|
||||
}
|
||||
}
|
||||
|
||||
const categoryCount = Object.keys(r).reduce(
|
||||
(prev, curr) => prev + (r[curr].length > 0 ? 1 : 0),
|
||||
0
|
||||
);
|
||||
|
||||
visibleTabs = [];
|
||||
|
||||
let tableTabs = document.createElement("div");
|
||||
tableTabs.className = "table-tabs";
|
||||
|
||||
const resultTable = document.createElement("div");
|
||||
resultTable.className = "result-table";
|
||||
|
||||
for (const key in r) {
|
||||
if (!r[key].length) continue;
|
||||
|
||||
const count = r[key].length >= 1000 ? "1000+" : String(r[key].length);
|
||||
|
||||
if (result.length > MIN_TABBED_RESULTS && categoryCount > 1) {
|
||||
const btn = document.createElement("button");
|
||||
btn.id = `result-tab-${key}`;
|
||||
btn.tabIndex = -1;
|
||||
btn.classList.add("page-search-header");
|
||||
|
||||
const labelSpan = document.createElement("span");
|
||||
setContent(labelSpan, categories[key]);
|
||||
|
||||
const countSpan = document.createElement("span");
|
||||
countSpan.style.fontWeight = "normal";
|
||||
countSpan.textContent = ` (${count})`;
|
||||
|
||||
labelSpan.appendChild(countSpan);
|
||||
btn.appendChild(labelSpan);
|
||||
|
||||
btn.addEventListener("click", () => {
|
||||
fixedTab = true;
|
||||
renderResult(key, btn);
|
||||
});
|
||||
|
||||
tableTabs.appendChild(btn);
|
||||
visibleTabs.push(key);
|
||||
} else {
|
||||
const header = document.createElement("span");
|
||||
header.className = "page-search-header";
|
||||
header.appendChild(document.createTextNode(categories[key]));
|
||||
|
||||
const countSpan = document.createElement("span");
|
||||
countSpan.style.fontWeight = "normal";
|
||||
countSpan.textContent = ` (${count})`;
|
||||
header.appendChild(countSpan);
|
||||
|
||||
tableTabs.appendChild(header);
|
||||
|
||||
(categoryCount > 1 ? resultTable : resultContainer).appendChild(tableTabs);
|
||||
|
||||
renderItems(r[key], resultTable);
|
||||
|
||||
tableTabs = document.createElement("div");
|
||||
tableTabs.className = "table-tabs";
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTab && result.length > MIN_TABBED_RESULTS && categoryCount > 1) {
|
||||
resultContainer.appendChild(tableTabs);
|
||||
|
||||
const activeBtn = document.querySelector(`button#result-tab-${activeTab}`);
|
||||
if (activeBtn) {
|
||||
activeBtn.classList.add("active-table-tab");
|
||||
activeBtn.tabIndex = 0;
|
||||
}
|
||||
|
||||
renderItems(r[activeTab], resultTable);
|
||||
}
|
||||
|
||||
resultContainer.appendChild(resultTable);
|
||||
|
||||
function renderResult(category, button) {
|
||||
activeTab = category;
|
||||
|
||||
Array.from(resultContainer.querySelectorAll("div.result-table")).forEach(el => el.remove());
|
||||
|
||||
const newTable = renderItems(r[activeTab]);
|
||||
resultContainer.appendChild(newTable);
|
||||
|
||||
const siblings = Array.from(button.parentElement?.children ?? []).filter(n => n !== button);
|
||||
siblings.forEach(sib => {
|
||||
sib.classList?.remove("active-table-tab");
|
||||
if (sib instanceof HTMLElement) sib.tabIndex = -1;
|
||||
});
|
||||
|
||||
button.classList.add("active-table-tab");
|
||||
button.tabIndex = 0;
|
||||
setSearchUrl();
|
||||
}
|
||||
}
|
||||
|
||||
function selectTab(category) {
|
||||
const btn = document.querySelector(`button#result-tab-${category}`);
|
||||
if (!btn) return;
|
||||
btn.focus();
|
||||
btn.dispatchEvent(new MouseEvent("click"));
|
||||
}
|
||||
|
||||
function select() {
|
||||
if (!this.classList.contains("selected")) setSelected(this);
|
||||
}
|
||||
|
||||
function unselect() {
|
||||
if (this.classList.contains("selected")) setSelected(null);
|
||||
}
|
||||
|
||||
function renderItems(items, table) {
|
||||
if (!table) {
|
||||
table = document.createElement("div");
|
||||
table.className = "result-table";
|
||||
}
|
||||
items.forEach(item => renderItem(item, table));
|
||||
return table;
|
||||
}
|
||||
|
||||
function renderItem(item, table) {
|
||||
const label = getResultLabel(item);
|
||||
const desc = getResultDescription(item);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = pathtoroot + getURL(item.indexItem, item.category);
|
||||
link.tabIndex = 0;
|
||||
link.className = "search-result-link";
|
||||
|
||||
link.addEventListener("focus", select.bind(link));
|
||||
link.addEventListener("blur", unselect.bind(link));
|
||||
link.addEventListener("click", closeSearch);
|
||||
|
||||
const labelSpan = document.createElement("span");
|
||||
labelSpan.className = "search-result-label";
|
||||
labelSpan.innerHTML = label;
|
||||
|
||||
const descSpan = document.createElement("span");
|
||||
descSpan.className = "search-result-desc";
|
||||
descSpan.innerHTML = desc;
|
||||
|
||||
link.appendChild(labelSpan);
|
||||
link.appendChild(descSpan);
|
||||
table.appendChild(link);
|
||||
}
|
||||
|
||||
let timeout;
|
||||
function scheduleSearch() {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = setTimeout(search, 200);
|
||||
}
|
||||
|
||||
function search() {
|
||||
setSearchUrl();
|
||||
const term = (searchTerm = input.value.trim());
|
||||
if (term === "") {
|
||||
clearResult();
|
||||
} else {
|
||||
setContent(notify, messages.searching);
|
||||
const module = modules ? modules.value : "";
|
||||
doSearch({ term, maxResults: 1200, module }, renderResults);
|
||||
}
|
||||
}
|
||||
|
||||
function setSearchUrl() {
|
||||
var query = input.value.trim();
|
||||
if (input.id === "search-input") {
|
||||
var link = document.getElementById("search-page-link");
|
||||
var href = pathtoroot + "search.html?q=" + encodeURI(query);
|
||||
if (activeTab && fixedTab) {
|
||||
href += "&c=" + activeTab;
|
||||
}
|
||||
if (modules && modules.value) {
|
||||
href += "&m=" + modules.value;
|
||||
}
|
||||
link.href = href;
|
||||
} else {
|
||||
var url = document.location.pathname;
|
||||
if (query) {
|
||||
url += "?q=" + encodeURI(query);
|
||||
if (activeTab && fixedTab) {
|
||||
url += "&c=" + activeTab;
|
||||
}
|
||||
if (modules && modules.value) {
|
||||
url += "&m=" + modules.value;
|
||||
}
|
||||
}
|
||||
history.replaceState({ query: query }, "", url);
|
||||
}
|
||||
}
|
||||
|
||||
input.addEventListener("input", () => {
|
||||
redirect = false;
|
||||
reset.style.visibility = input.value ? "visible" : "hidden";
|
||||
scheduleSearch();
|
||||
});
|
||||
|
||||
input.addEventListener("focus", openSearch);
|
||||
|
||||
input.addEventListener("mouseup", function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function setSelected(link) {
|
||||
if (selectedLink) {
|
||||
selectedLink.classList.remove("selected");
|
||||
selectedLink.blur();
|
||||
}
|
||||
if (link) {
|
||||
link.classList.add("selected");
|
||||
link.focus({ focusVisible: true });
|
||||
link.scrollIntoView({ block: "nearest" });
|
||||
}
|
||||
selectedLink = link;
|
||||
}
|
||||
|
||||
function clearResult() {
|
||||
setContent(notify, messages.enterTerm);
|
||||
activeTab = "";
|
||||
fixedTab = false;
|
||||
empty(resultContainer);
|
||||
reset.style.visibility = input.value ? "visible" : "hidden";
|
||||
setSearchUrl();
|
||||
}
|
||||
|
||||
function openSearch() {
|
||||
resultSection.style.display = "block";
|
||||
|
||||
if (input.id !== "search-input" || overlay) return;
|
||||
|
||||
overlay = document.createElement("div");
|
||||
overlay.className = "overlay";
|
||||
document.querySelector("header")?.appendChild(overlay);
|
||||
overlay.addEventListener("click", closeSearch);
|
||||
overlay.style.display = "block";
|
||||
|
||||
document.body.style.setProperty("overflow-y", "hidden");
|
||||
|
||||
var inputDiv = document.getElementById("search-input-container");
|
||||
inputDiv.appendChild(input);
|
||||
inputDiv.appendChild(reset);
|
||||
input.focus();
|
||||
|
||||
if (input.value) {
|
||||
input.select();
|
||||
search();
|
||||
}
|
||||
}
|
||||
|
||||
function closeSearch() {
|
||||
clearResult();
|
||||
resultSection.style.display = "none";
|
||||
|
||||
if (overlay) {
|
||||
var inputDiv = document.querySelector("div.sub-nav div.nav-list-search");
|
||||
inputDiv.appendChild(input);
|
||||
inputDiv.appendChild(reset);
|
||||
|
||||
overlay.remove();
|
||||
overlay = null;
|
||||
document.body.style.removeProperty("overflow-y");
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("hashchange", closeSearch);
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.ctrlKey || e.altKey || e.metaKey || resultSection.style.display !== "block") return;
|
||||
|
||||
if (e.key === "Escape") {
|
||||
if (input.value) {
|
||||
input.value = "";
|
||||
input.focus();
|
||||
clearResult();
|
||||
} else {
|
||||
closeSearch();
|
||||
input.blur();
|
||||
}
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.target === modules) return;
|
||||
|
||||
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
||||
if (activeTab && visibleTabs.length > 1 && e.target !== input) {
|
||||
const tab = visibleTabs.indexOf(activeTab);
|
||||
const newTab = e.key === "ArrowLeft"
|
||||
? Math.max(0, tab - 1)
|
||||
: Math.min(visibleTabs.length - 1, tab + 1);
|
||||
|
||||
if (newTab !== tab) selectTab(visibleTabs[newTab]);
|
||||
e.preventDefault();
|
||||
}
|
||||
} else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
||||
const links = Array.from(document.querySelectorAll("div.result-table > a.search-result-link"));
|
||||
const current = links.indexOf(selectedLink);
|
||||
|
||||
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
||||
if (current > 0) {
|
||||
setSelected(links[current - 1]);
|
||||
} else {
|
||||
setSelected(null);
|
||||
input.focus();
|
||||
}
|
||||
} else if (e.key === "ArrowDown") {
|
||||
if (current < links.length - 1) setSelected(links[current + 1]);
|
||||
}
|
||||
e.preventDefault();
|
||||
} else if (e.target !== input && (e.key.length === 1 || e.key === "Backspace")) {
|
||||
setSelected(null);
|
||||
input.focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
reset.addEventListener("click", () => {
|
||||
input.value = "";
|
||||
input.focus();
|
||||
clearResult();
|
||||
});
|
||||
|
||||
if (modules) {
|
||||
modules.addEventListener("change", () => {
|
||||
if (input.value) search();
|
||||
input.focus();
|
||||
try {
|
||||
localStorage.setItem("search-modules", modules.value);
|
||||
} catch (unsupported) {
|
||||
console.log("Error setting module: " + unsupported);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Enable/initialize
|
||||
input.disabled = false;
|
||||
input.setAttribute("autocapitalize", "off");
|
||||
reset.disabled = false;
|
||||
|
||||
var urlParams = new URLSearchParams(window.location.search);
|
||||
if (modules) {
|
||||
if (urlParams.has("m")) {
|
||||
modules.value = urlParams.get("m");
|
||||
} else {
|
||||
try {
|
||||
const searchModules = localStorage.getItem("search-modules");
|
||||
if (searchModules) modules.value = searchModules;
|
||||
} catch (unsupported) {
|
||||
console.log("Error getting module: " + unsupported);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (urlParams.has("q")) {
|
||||
input.value = urlParams.get("q");
|
||||
reset.style.visibility = input.value ? "visible" : "hidden";
|
||||
}
|
||||
if (urlParams.has("c")) {
|
||||
activeTab = urlParams.get("c");
|
||||
fixedTab = true;
|
||||
}
|
||||
if (urlParams.get("r")) {
|
||||
redirect = true;
|
||||
}
|
||||
if (input.value) {
|
||||
search();
|
||||
} else {
|
||||
setContent(notify, messages.enterTerm);
|
||||
}
|
||||
if (input.id === "page-search-input") {
|
||||
input.select();
|
||||
input.focus();
|
||||
}
|
||||
});
|
||||
|
||||
@ -83,9 +83,11 @@
|
||||
--search-input-background-color: #ffffff;
|
||||
--search-input-text-color: #000000;
|
||||
--search-input-placeholder-color: #757575;
|
||||
--overlay-background: rgba(153, 169, 183, 0.3);
|
||||
/* Highlight color for active search tag target */
|
||||
--search-tag-background-color: #ffff66;
|
||||
--search-tag-text-color: var(--block-text-color);
|
||||
--search-hover-background: #d8d8e0;
|
||||
/* Copy button colors and filters */
|
||||
--button-border-color: #b0b8c8;
|
||||
--button-active-filter: brightness(96%);
|
||||
@ -139,8 +141,10 @@
|
||||
--search-input-background-color: #303030;
|
||||
--search-input-text-color: #d0d0d0;
|
||||
--search-input-placeholder-color: #979797;
|
||||
--overlay-background: rgba(0, 0, 0, 0.45);
|
||||
--search-tag-background-color: #c6c61e;
|
||||
--search-tag-text-color: #282828;
|
||||
--search-hover-background: #484850;
|
||||
--button-border-color: #909090;
|
||||
--button-active-filter: brightness(96%);
|
||||
--button-focus-filter: brightness(104%);
|
||||
@ -296,6 +300,7 @@ hr {
|
||||
height: 100%;
|
||||
max-width: var(--max-content-width);
|
||||
margin: var(--content-margin);
|
||||
position: relative;
|
||||
}
|
||||
.top-nav {
|
||||
background-color:var(--navbar-background-color);
|
||||
@ -381,7 +386,7 @@ div.sub-nav {
|
||||
min-height: var(--sub-nav-height);
|
||||
}
|
||||
ol.sub-nav-list {
|
||||
flex: 1 1 90%;
|
||||
flex: 1 1 auto;
|
||||
line-height: 1.7;
|
||||
overflow: auto;
|
||||
padding-left:6px;
|
||||
@ -411,11 +416,12 @@ ol.sub-nav-list a.current-selection {
|
||||
border-radius: 3px;
|
||||
}
|
||||
.sub-nav .nav-list-search {
|
||||
flex: 1 1 10%;
|
||||
flex: 0 0 auto;
|
||||
margin: 4.5px 15px auto 5px;
|
||||
padding: 1px 0;
|
||||
position:relative;
|
||||
white-space: nowrap;
|
||||
width: 342px;
|
||||
}
|
||||
.top-nav .nav-list a:link, .top-nav .nav-list a:active, .top-nav .nav-list a:visited {
|
||||
color:var(--navbar-text-color);
|
||||
@ -1065,106 +1071,6 @@ main, nav, header, footer, section {
|
||||
/*
|
||||
* Styles for javadoc search.
|
||||
*/
|
||||
.ui-menu .ui-state-active {
|
||||
/* Overrides the color of selection used in jQuery UI */
|
||||
background: var(--selected-background-color);
|
||||
color: var(--selected-text-color);
|
||||
/* Workaround for browser bug, see JDK-8275889 */
|
||||
margin: -1px 0;
|
||||
border-top: 1px solid var(--selected-background-color);
|
||||
border-bottom: 1px solid var(--selected-background-color);
|
||||
}
|
||||
.ui-autocomplete-category {
|
||||
font-weight:bold;
|
||||
font-size:15px;
|
||||
padding:7px 8px;
|
||||
background-color:var(--navbar-background-color);
|
||||
color:var(--navbar-text-color);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.ui-autocomplete {
|
||||
max-height:calc(98vh - var(--nav-height));
|
||||
max-width:min(75vw, calc(var(--max-content-width) * 0.748));
|
||||
overflow-y:auto;
|
||||
white-space:nowrap;
|
||||
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
ul.ui-autocomplete {
|
||||
position:fixed;
|
||||
z-index:10;
|
||||
background-color: var(--body-background-color);
|
||||
}
|
||||
ul.ui-autocomplete li {
|
||||
float:left;
|
||||
clear:both;
|
||||
min-width:100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
ul.ui-autocomplete li.ui-static-link {
|
||||
position:sticky;
|
||||
bottom:0;
|
||||
left:0;
|
||||
background: var(--subnav-background-color);
|
||||
padding: 5px 0;
|
||||
font-family: var(--body-font-family);
|
||||
font-size: 0.93em;
|
||||
font-weight: bold;
|
||||
z-index: 10;
|
||||
}
|
||||
li.ui-static-link a, li.ui-static-link a:visited {
|
||||
text-decoration:none;
|
||||
color:var(--link-color);
|
||||
float:right;
|
||||
margin-right:20px;
|
||||
}
|
||||
.ui-autocomplete > li.result-item:nth-child(even) {
|
||||
background-color: var(--even-row-color)
|
||||
}
|
||||
.ui-autocomplete > li.result-item:nth-child(odd) {
|
||||
background-color: var(--odd-row-color)
|
||||
}
|
||||
.ui-autocomplete {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
}
|
||||
.ui-autocomplete > li,
|
||||
.ui-autocomplete > li > a {
|
||||
grid-column: 1 / 3;
|
||||
}
|
||||
.ui-autocomplete > li.result-item,
|
||||
.ui-autocomplete > li.result-item > a {
|
||||
display: grid;
|
||||
grid-template-columns: subgrid;
|
||||
}
|
||||
.ui-autocomplete > li.result-item {
|
||||
font-family: var(--body-font-family);
|
||||
font-size: var(--body-font-size);
|
||||
line-height: 1.7;
|
||||
}
|
||||
.ui-autocomplete .search-result-label {
|
||||
padding: 1px 4px;
|
||||
color: var(--block-text-color);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.ui-autocomplete .search-result-desc {
|
||||
font-size: var(--nav-font-size);
|
||||
padding: 2px 4px;
|
||||
color: var(--block-text-color);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.ui-autocomplete .result-highlight {
|
||||
font-weight:bold;
|
||||
}
|
||||
.ui-menu .ui-state-active .search-result-label,
|
||||
.ui-menu .ui-state-active .search-result-desc {
|
||||
color: var(--selected-text-color);
|
||||
}
|
||||
.ui-menu .ui-menu-item-wrapper {
|
||||
padding: 3px 4px;
|
||||
}
|
||||
input[type="text"] {
|
||||
background-image:var(--glass-svg);
|
||||
background-size:13px;
|
||||
@ -1184,8 +1090,9 @@ input#page-search-input {
|
||||
margin: 10px 0;
|
||||
}
|
||||
input#search-input {
|
||||
width: 270px;
|
||||
width: 300px;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
input.filter-input {
|
||||
min-width: 40px;
|
||||
@ -1205,6 +1112,7 @@ input#reset-search, input.reset-filter, input#page-search-reset {
|
||||
min-height:12px;
|
||||
font-size:0;
|
||||
visibility:hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
input#reset-search {
|
||||
position:absolute;
|
||||
@ -1236,6 +1144,9 @@ select {
|
||||
background: #f0f0f0;
|
||||
border: 1px solid #909090;
|
||||
}
|
||||
select#search-modules {
|
||||
margin: 0 10px 10px 8px;
|
||||
}
|
||||
kbd {
|
||||
background-color: #eeeeee;
|
||||
color: #282828;
|
||||
@ -1262,56 +1173,149 @@ section.class-description h1 > span:target {
|
||||
details.page-search-details {
|
||||
display: inline-block;
|
||||
}
|
||||
div#result-container {
|
||||
div#search-result-container {
|
||||
font-size: 1em;
|
||||
}
|
||||
#result-container .result-highlight {
|
||||
font-weight:bold;
|
||||
#search-result-container .result-highlight {
|
||||
font-weight: bold;
|
||||
}
|
||||
#result-container div.result-table {
|
||||
#search-result-container div.result-table {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(40%, max-content) minmax(40%, auto);
|
||||
}
|
||||
#result-container div.result-table > div.table-header,
|
||||
#result-container div.result-table > a.search-result-link {
|
||||
#search-result-container div.result-table > div.table-header,
|
||||
#search-result-container div.result-table > a.search-result-link {
|
||||
display: grid;
|
||||
grid-template-columns: subgrid;
|
||||
grid-column: 1 / 3;
|
||||
margin: 0;
|
||||
}
|
||||
#result-container div.result-table > div.table-header > span {
|
||||
#search-result-container div.result-table > div.table-header > span {
|
||||
padding: 5px 12px;
|
||||
font-size: 0.93em;
|
||||
background-color: var(--subnav-background-color);
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link > span {
|
||||
#search-result-container a.search-result-link > span {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link:nth-child(odd) {
|
||||
#search-result-container a.search-result-link:nth-child(odd) {
|
||||
background-color: var(--odd-row-color)
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link:nth-child(even) {
|
||||
#search-result-container a.search-result-link:nth-child(even) {
|
||||
background-color: var(--even-row-color)
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link {
|
||||
#search-result-container a.search-result-link {
|
||||
color: var(--block-text-color);
|
||||
white-space: nowrap;
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link:focus-visible,
|
||||
#result-container div.result-table > a.search-result-link.selected {
|
||||
#search-result-container a.search-result-link:hover {
|
||||
background-color: var(--search-hover-background);
|
||||
}
|
||||
#search-result-container a.search-result-link:focus-visible,
|
||||
#search-result-container a.search-result-link.selected {
|
||||
background-color: var(--selected-background-color);
|
||||
color: var(--selected-text-color);
|
||||
outline: none;
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link .search-result-label {
|
||||
#search-result-container a.search-result-link .search-result-label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
#result-container div.result-table > a.search-result-link .search-result-desc {
|
||||
#search-result-container a.search-result-link .search-result-desc {
|
||||
font-size: var(--nav-font-size);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
div.overlay {
|
||||
position: fixed;
|
||||
left:0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--overlay-background);
|
||||
z-index: 3;
|
||||
backdrop-filter: blur(0.3px);
|
||||
}
|
||||
div.sub-nav div.search-form {
|
||||
display: grid;
|
||||
grid-template-columns: auto min-content;
|
||||
place-items: start end;
|
||||
padding-top: 5px;
|
||||
}
|
||||
div.sub-nav div.search-form > div:has(label) {
|
||||
padding: 10px 8px 7px 10px;
|
||||
}
|
||||
div.sub-nav div.search-form div#search-input-container {
|
||||
position: relative;
|
||||
padding: 1px 0;
|
||||
margin-right: 9px;
|
||||
margin-top: 3.5px;
|
||||
}
|
||||
div.sub-nav div.search-form > div:has(select) {
|
||||
place-self: start;
|
||||
padding: 0;
|
||||
margin-top: 4px;
|
||||
}
|
||||
div.sub-nav div.search-form select#search-modules {
|
||||
margin: 2px 0;
|
||||
}
|
||||
div.sub-nav div#search-result-section {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: -5px;
|
||||
max-width: min(75vw, calc(var(--max-content-width) * 0.75));
|
||||
z-index: 7;
|
||||
background-color: var(--toc-background-color);
|
||||
color: var(--body-text-color);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 3px 12px rgba(0,0,0,0.16), 0 3px 9px rgba(0,0,0,0.23);
|
||||
}
|
||||
div.sub-nav #search-result-container a.search-result-link {
|
||||
display: grid;
|
||||
grid-template-columns: subgrid;
|
||||
grid-column: 1 / 3;
|
||||
padding: 5px;
|
||||
}
|
||||
div.sub-nav #search-result-container a.search-result-link > span {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
div.sub-nav div#search-result-section:has(button.active-table-tab) {
|
||||
width: calc(var(--max-content-width) * 0.75);
|
||||
}
|
||||
div.sub-nav div#search-result-section div.table-tabs {
|
||||
padding-left: 3px;
|
||||
}
|
||||
div.sub-nav div.search-links {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
background-color: var(--subnav-background-color);
|
||||
color: var(--subnav-link-color);
|
||||
margin-top: 6px;
|
||||
}
|
||||
div.sub-nav div.search-links > div {
|
||||
padding: 10px;
|
||||
font-size: var(--nav-font-size);
|
||||
}
|
||||
div.sub-nav div.search-links > div:first-child {
|
||||
justify-self: start;
|
||||
}
|
||||
div.sub-nav div.search-links > div:last-child {
|
||||
justify-self: end;
|
||||
}
|
||||
div.sub-nav div#search-result-container .result-table {
|
||||
max-height: calc(96vh - var(--nav-height) - 110px);
|
||||
overflow-y: scroll;
|
||||
overscroll-behavior: contain;
|
||||
margin-top: 3px;
|
||||
}
|
||||
div.sub-nav div#search-result-container .result-table:has(div.table-tabs) {
|
||||
max-height: calc(96vh - var(--nav-height) - 74px);
|
||||
}
|
||||
div.sub-nav div#search-result-container > p {
|
||||
text-align: center;
|
||||
}
|
||||
.page-search-info {
|
||||
background-color: var(--subnav-background-color);
|
||||
border-radius: 3px;
|
||||
@ -1647,7 +1651,13 @@ table.striped > tbody > tr > th {
|
||||
}
|
||||
@media screen and (max-width: 1200px) {
|
||||
input#search-input {
|
||||
width: 22.5vw;
|
||||
width: 25vw;
|
||||
}
|
||||
.sub-nav .nav-list-search {
|
||||
width: calc(25vw + 42px);
|
||||
}
|
||||
div.sub-nav select#search-modules {
|
||||
max-width: calc(25vw + 50px);
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1000px) {
|
||||
@ -1739,26 +1749,20 @@ table.striped > tbody > tr > th {
|
||||
transform-origin: 10% 90%;
|
||||
width: 26px;
|
||||
}
|
||||
.ui-autocomplete {
|
||||
#search-result-container div.result-table {
|
||||
display: block;
|
||||
grid-template-columns: none;
|
||||
}
|
||||
.ui-autocomplete > li,
|
||||
.ui-autocomplete > li > a,
|
||||
.ui-autocomplete > li.result-item,
|
||||
.ui-autocomplete > li.result-item > a {
|
||||
#search-result-container div.result-table > a.search-result-link > span {
|
||||
grid-column: unset;
|
||||
display: block;
|
||||
grid-template-columns: none;
|
||||
}
|
||||
.ui-autocomplete > li.result-item {
|
||||
line-height: 1.45;
|
||||
#search-result-container div.result-table > a.search-result-link > span {
|
||||
padding: 3px 8px;
|
||||
}
|
||||
.ui-autocomplete .search-result-label {
|
||||
display: block;
|
||||
}
|
||||
.ui-autocomplete .search-result-desc {
|
||||
display: block;
|
||||
#search-result-container div.result-table > a.search-result-link {
|
||||
padding: 3px 5px;
|
||||
}
|
||||
.top-nav nav.toc .toc-sort-toggle {
|
||||
background: transparent;
|
||||
@ -1779,6 +1783,12 @@ table.striped > tbody > tr > th {
|
||||
body {
|
||||
-webkit-text-size-adjust: none;
|
||||
}
|
||||
div.sub-nav div#search-result-section {
|
||||
max-width: 97vw;
|
||||
}
|
||||
div.sub-nav div#search-result-section:has(button.active-table-tab) {
|
||||
width: calc(var(--max-content-width) * 0.9);
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 600px) {
|
||||
.nav-list-search > a {
|
||||
@ -1791,7 +1801,13 @@ table.striped > tbody > tr > th {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
input#search-input {
|
||||
width: 18vw;
|
||||
width: calc(18vw + 30px);
|
||||
}
|
||||
.sub-nav .nav-list-search {
|
||||
width: calc(18vw + 72px);
|
||||
}
|
||||
div.sub-nav select#search-modules {
|
||||
max-width: calc(18vw + 68px);
|
||||
}
|
||||
.inherited-list h3 {
|
||||
overflow: auto clip;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2010, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -376,8 +376,10 @@ doclet.search.many_results=Found {0} results
|
||||
doclet.search.loading=Loading search index...
|
||||
doclet.search.searching=Searching...
|
||||
doclet.search.redirecting=Redirecting to first result...
|
||||
# {0} is a select input containing all_modules message below and module names
|
||||
doclet.search.in=in {0}
|
||||
# Used as label for the search input field
|
||||
doclet.search.for=Search for
|
||||
# Used as label for the module select control which defaults to doclet.search.all_modules
|
||||
doclet.search.in_modules=in
|
||||
doclet.search.all_modules=all modules
|
||||
doclet.search.modules=Modules
|
||||
doclet.search.packages=Packages
|
||||
@ -385,7 +387,8 @@ doclet.search.classes_and_interfaces=Classes and Interfaces
|
||||
doclet.search.types=Types
|
||||
doclet.search.members=Members
|
||||
doclet.search.search_tags=Search Tags
|
||||
doclet.search.linkSearchPageLabel=Go to search page
|
||||
doclet.search.linkSearchPageLabel=Search page
|
||||
doclet.search.linkSearchHelpLabel=Search help
|
||||
|
||||
doclet.snippet.contents.none=\
|
||||
@snippet does not specify contents
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -133,20 +133,8 @@ public class DocPaths {
|
||||
/** The name of the syntax highlighting script file. */
|
||||
public static final DocPath HIGHLIGHT_JS = DocPath.create("highlight.js");
|
||||
|
||||
/** The name of the default jQuery directory. */
|
||||
public static final DocPath JQUERY_DIR = DocPath.create("jquery");
|
||||
|
||||
/** The name of the default jQuery javascript file. */
|
||||
public static final DocPath JQUERY_JS = DocPath.create("jquery-3.7.1.min.js");
|
||||
|
||||
/** The name of the default jQuery UI stylesheet file. */
|
||||
public static final DocPath JQUERY_UI_CSS = DocPath.create("jquery-ui.min.css");
|
||||
|
||||
/** The name of the default jQuery UI javascript file. */
|
||||
public static final DocPath JQUERY_UI_JS = DocPath.create("jquery-ui.min.js");
|
||||
|
||||
/** The name of the default jQuery file for legal notices. */
|
||||
public static final DocPath JQUERY_MD = DocPath.create("jquery.md");
|
||||
/** The name of the dejavu file for legal notices. */
|
||||
public static final DocPath DEJAVU_MD = DocPath.create("dejavufonts.md");
|
||||
|
||||
/** The name of the directory for legal files. */
|
||||
public static final DocPath LEGAL = DocPath.create("legal");
|
||||
@ -342,9 +330,6 @@ public class DocPaths {
|
||||
/** The name of the template for the search javascript file. */
|
||||
public static final DocPath SEARCH_JS_TEMPLATE = DocPath.create("search.js.template");
|
||||
|
||||
/** The name of the search javascript file. */
|
||||
public static final DocPath SEARCH_PAGE_JS = DocPath.create("search-page.js");
|
||||
|
||||
/** The name of the file for the serialized form info. */
|
||||
public static final DocPath SERIALIZED_FORM = DocPath.create("serialized-form.html");
|
||||
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
## jQuery v3.7.1
|
||||
|
||||
### jQuery License
|
||||
```
|
||||
jQuery v 3.7.1
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
@ -1,49 +0,0 @@
|
||||
## jQuery UI v1.14.1
|
||||
|
||||
### jQuery UI License
|
||||
```
|
||||
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/jquery/jquery-ui
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code contained within the demos directory.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
All files located in the node_modules and external directories are
|
||||
externally maintained libraries used by this software which have their
|
||||
own licenses; we recommend you read them, as their terms may differ from
|
||||
the terms above.
|
||||
|
||||
```
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8293177 8324774 8357458
|
||||
* @bug 8293177 8324774 8357458 8378228
|
||||
* @summary Verify version numbers in legal files
|
||||
* @library /test/lib
|
||||
* @build jtreg.SkippedException
|
||||
@ -54,8 +54,6 @@ public class CheckLibraryVersions {
|
||||
// %V is replaced with the version string
|
||||
// %M is replaced twice, once with an empty string and once with ".min"
|
||||
static final Map<String, List<String>> libraries = Map.of(
|
||||
"jquery.md", List.of("jquery/jquery-%V%M.js"),
|
||||
"jqueryUI.md", List.of("jquery/jquery-ui%M.js", "jquery/jquery-ui%M.css"),
|
||||
"dejavufonts.md", List.of("fonts/dejavu.css"),
|
||||
"highlightjs.md", List.of("highlight.js")
|
||||
);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8267574
|
||||
* @bug 8267574 8378228
|
||||
* @summary check stylesheet names against HtmlStyle
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.html
|
||||
* jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.markup
|
||||
@ -136,12 +136,11 @@ public class CheckStylesheetClasses {
|
||||
// for doc-comment authors; maybe worthy of inclusion in HtmlStyle, just to be documented
|
||||
removeAll(styleSheetNames, "borderless", "plain", "striped");
|
||||
|
||||
// used in search.js and search-page.js; may be worth documenting in HtmlStyle
|
||||
removeAll(styleSheetNames, "result-highlight", "result-item", "anchor-link", "expanded",
|
||||
"page-search-header", "result-table", "ui-autocomplete", "ui-autocomplete-category",
|
||||
"ui-state-active", "ui-menu", "ui-menu-item-wrapper", "ui-static-link",
|
||||
"search-result-desc", "search-result-label", "search-result-link", "selected",
|
||||
"sort-asc", "sort-desc", "two-column-search-results", "visible");
|
||||
// used in search.js; may be worth documenting in HtmlStyle
|
||||
removeAll(styleSheetNames, "result-highlight", "anchor-link", "expanded", "overlay",
|
||||
"page-search-header", "result-table", "search-result-desc", "search-result-label",
|
||||
"search-result-link", "selected", "sort-asc", "sort-desc", "two-column-search-results",
|
||||
"visible");
|
||||
|
||||
// very JDK specific
|
||||
styleSheetNames.remove("module-graph");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -113,7 +113,6 @@ public class TestFonts extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
checkFiles(true, "resource-files/copy.svg",
|
||||
"resource-files/glass.svg",
|
||||
"resource-files/jquery-ui.min.css",
|
||||
"resource-files/link.svg",
|
||||
"resource-files/stylesheet.css",
|
||||
"resource-files/x.svg");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8323628 8351626
|
||||
* @bug 8323628 8351626 8378228
|
||||
* @summary Update license on "pass-through" files
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -62,8 +62,7 @@ public class TestPassThruFiles extends JavadocTester {
|
||||
var files = List.of(
|
||||
"resource-files/stylesheet.css",
|
||||
"script-files/script.js",
|
||||
"script-files/search.js",
|
||||
"script-files/search-page.js"
|
||||
"script-files/search.js"
|
||||
);
|
||||
|
||||
for (var f : files) {
|
||||
@ -113,7 +112,6 @@ public class TestPassThruFiles extends JavadocTester {
|
||||
*/
|
||||
private boolean requiresCheck(Path p) {
|
||||
var fn = p.getFileName().toString();
|
||||
return !fn.startsWith("jquery")
|
||||
&& !fn.endsWith(".svg");
|
||||
return !fn.endsWith(".svg");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,7 @@
|
||||
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
|
||||
* 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
|
||||
* 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528
|
||||
* 8266808 8248863 8305710 8318082 8347058 8350638 8345555
|
||||
* 8266808 8248863 8305710 8318082 8347058 8350638 8345555 8378228
|
||||
* @summary Test the search feature of javadoc.
|
||||
* @library ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
@ -57,7 +57,7 @@ public class TestSearch extends JavadocTester {
|
||||
testSrc("UnnamedPkgClass.java"));
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput("UnnamedPkgClass.html", true);
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -81,7 +81,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkSingleIndex();
|
||||
checkSingleIndexSearchTagDuplication();
|
||||
checkSearchTagIndex();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkAllPkgsAllClasses();
|
||||
checkFiles(true,
|
||||
@ -106,7 +106,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkSingleIndex();
|
||||
checkSingleIndexSearchTagDuplication();
|
||||
checkSearchTagIndex();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -126,7 +126,7 @@ public class TestSearch extends JavadocTester {
|
||||
"pkg", "pkg1", "pkg2", "pkg3");
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput(false);
|
||||
checkJqueryAndImageFiles(false);
|
||||
checkImageFiles(false);
|
||||
checkFiles(false,
|
||||
"member-search-index.js",
|
||||
"package-search-index.js",
|
||||
@ -151,7 +151,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkSearchOutput(true);
|
||||
checkSingleIndex();
|
||||
checkSingleIndexSearchTagDuplication();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -172,7 +172,7 @@ public class TestSearch extends JavadocTester {
|
||||
"pkg", "pkg1", "pkg2", "pkg3");
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput(false);
|
||||
checkJqueryAndImageFiles(false);
|
||||
checkImageFiles(false);
|
||||
checkFiles(false,
|
||||
"member-search-index.js",
|
||||
"package-search-index.js",
|
||||
@ -194,7 +194,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput(true);
|
||||
checkIndexNoComment();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -216,7 +216,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput(true);
|
||||
checkIndexNoDeprecated();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -239,7 +239,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkSearchOutput(true);
|
||||
checkSplitIndex();
|
||||
checkSplitIndexSearchTagDuplication();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -261,7 +261,7 @@ public class TestSearch extends JavadocTester {
|
||||
checkExit(Exit.OK);
|
||||
checkSearchOutput(true);
|
||||
checkJavaFXOutput();
|
||||
checkJqueryAndImageFiles(true);
|
||||
checkImageFiles(true);
|
||||
checkSearchJS();
|
||||
checkFiles(true,
|
||||
"member-search-index.js",
|
||||
@ -417,14 +417,6 @@ public class TestSearch extends JavadocTester {
|
||||
void checkSearchOutput(String fileName, boolean expectedOutput) {
|
||||
// Test for search related markup
|
||||
checkOutput(fileName, expectedOutput,
|
||||
"""
|
||||
<link rel="stylesheet" type="text/css" href="resource-files/jquery-ui.min.css">
|
||||
""",
|
||||
"""
|
||||
<script type="text/javascript" src="script-files/jquery-3.7.1.min.js"></script>
|
||||
""",
|
||||
"""
|
||||
<script type="text/javascript" src="script-files/jquery-ui.min.js"></script>""",
|
||||
"""
|
||||
const pathtoroot = "./";
|
||||
loadScripts();
|
||||
@ -437,6 +429,10 @@ public class TestSearch extends JavadocTester {
|
||||
holder="Search documentation (type /)" aria-label="Search in documentation" auto\
|
||||
complete="off" spellcheck="false"><input type="reset" id="reset-search" disabled\
|
||||
value="Reset"></div>""");
|
||||
checkOutput(fileName, false,
|
||||
"jquery-ui.min.css",
|
||||
"jquery-3.7.1.min.js",
|
||||
"jquery-ui.min.js");
|
||||
}
|
||||
|
||||
void checkSingleIndex() {
|
||||
@ -669,14 +665,15 @@ public class TestSearch extends JavadocTester {
|
||||
"AnotherClass.java:68: warning: invalid usage of tag {@index");
|
||||
}
|
||||
|
||||
void checkJqueryAndImageFiles(boolean expectedOutput) {
|
||||
void checkImageFiles(boolean expectedOutput) {
|
||||
checkFiles(expectedOutput,
|
||||
"script-files/search.js",
|
||||
"script-files/jquery-3.7.1.min.js",
|
||||
"script-files/jquery-ui.min.js",
|
||||
"resource-files/jquery-ui.min.css",
|
||||
"resource-files/x.svg",
|
||||
"resource-files/glass.svg");
|
||||
checkFiles(false,
|
||||
"script-files/jquery-3.7.1.min.js",
|
||||
"script-files/jquery-ui.min.js",
|
||||
"resource-files/jquery-ui.min.css");
|
||||
}
|
||||
|
||||
void checkSearchJS() {
|
||||
@ -689,9 +686,7 @@ public class TestSearch extends JavadocTester {
|
||||
"function getURLPrefix(item, category) {",
|
||||
"url += item.l;");
|
||||
|
||||
checkOutput("script-files/search-page.js", true,
|
||||
"function renderResults(result) {",
|
||||
"function selectTab(category) {");
|
||||
checkFiles(false, "script-files/search-page.js");
|
||||
|
||||
checkCssClasses("script-files/search.js", "resource-files/stylesheet.css");
|
||||
}
|
||||
@ -701,8 +696,8 @@ public class TestSearch extends JavadocTester {
|
||||
// are also defined as class selectors somewhere in the stylesheet file.
|
||||
String js = readOutputFile(jsFile);
|
||||
Set<String> cssClasses = new TreeSet<>();
|
||||
addMatches(js, Pattern.compile("class=\\\\*\"([^\\\\\"]+)\\\\*\""), cssClasses);
|
||||
addMatches(js, Pattern.compile("attr\\(\"class\", \"([^\"]+)\"\\)"), cssClasses);
|
||||
addMatches(js, Pattern.compile("class=[\"']([-\\w]+)[\"']"), cssClasses);
|
||||
addMatches(js, Pattern.compile("classList.add\\([\"']([-\\w]+)[\"']\\)"), cssClasses);
|
||||
// verify that the regex did find use of CSS class names
|
||||
checking("Checking CSS classes found");
|
||||
if (cssClasses.isEmpty()) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -132,6 +132,7 @@ public class TestStylesheet extends JavadocTester {
|
||||
min-height:12px;
|
||||
font-size:0;
|
||||
visibility:hidden;
|
||||
cursor: pointer;
|
||||
}""",
|
||||
"""
|
||||
::placeholder {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -207,7 +207,6 @@ class APITest {
|
||||
"resource-files/copy.svg",
|
||||
"resource-files/down.svg",
|
||||
"resource-files/glass.svg",
|
||||
"resource-files/jquery-ui.min.css",
|
||||
"resource-files/left.svg",
|
||||
"resource-files/link.svg",
|
||||
"resource-files/moon.svg",
|
||||
@ -241,11 +240,8 @@ class APITest {
|
||||
"resource-files/fonts/DejaVuLGCSerif-Italic.woff2",
|
||||
"resource-files/fonts/DejaVuLGCSerif.woff",
|
||||
"resource-files/fonts/DejaVuLGCSerif.woff2",
|
||||
"script-files/jquery-3.7.1.min.js",
|
||||
"script-files/jquery-ui.min.js",
|
||||
"script-files/script.js",
|
||||
"script-files/search.js",
|
||||
"script-files/search-page.js",
|
||||
"tag-search-index.js",
|
||||
"type-search-index.js"
|
||||
));
|
||||
@ -255,11 +251,8 @@ class APITest {
|
||||
!s.endsWith("-search-index.js")
|
||||
&& !s.equals("index-all.html")
|
||||
&& !s.equals("resource-files/glass.svg")
|
||||
&& !s.equals("resource-files/jquery-ui.min.css")
|
||||
&& !s.equals("resource-files/x.svg")
|
||||
&& !s.startsWith("script-files/jquery-")
|
||||
&& !s.equals("script-files/search.js")
|
||||
&& !s.equals("script-files/search-page.js")
|
||||
&& !s.equals("search.html")
|
||||
&& !s.equals("allclasses-index.html")
|
||||
&& !s.equals("allpackages-index.html")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user