author | hannesw |
Wed, 27 Nov 2019 13:08:16 +0100 | |
changeset 59294 | 48b88b9c11eb |
parent 54598 | a9953a8ccd66 |
permissions | -rw-r--r-- |
33920 | 1 |
/* |
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
47447
diff
changeset
|
2 |
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
33920 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
40511 | 26 |
var moduleSearchIndex; |
33920 | 27 |
var packageSearchIndex; |
28 |
var typeSearchIndex; |
|
29 |
var memberSearchIndex; |
|
30 |
var tagSearchIndex; |
|
31 |
function loadScripts(doc, tag) { |
|
54598
a9953a8ccd66
8222526: Use of no longer existing jquery directory in script.js
hannesw
parents:
54350
diff
changeset
|
32 |
createElem(doc, tag, 'script-dir/jszip/dist/jszip.js'); |
a9953a8ccd66
8222526: Use of no longer existing jquery directory in script.js
hannesw
parents:
54350
diff
changeset
|
33 |
createElem(doc, tag, 'script-dir/jszip-utils/dist/jszip-utils.js'); |
33920 | 34 |
if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 || |
35 |
window.navigator.userAgent.indexOf('Edge/') > 0) { |
|
54598
a9953a8ccd66
8222526: Use of no longer existing jquery directory in script.js
hannesw
parents:
54350
diff
changeset
|
36 |
createElem(doc, tag, 'script-dir/jszip-utils/dist/jszip-utils-ie.js'); |
33920 | 37 |
} |
38 |
createElem(doc, tag, 'search.js'); |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
39 |
|
40511 | 40 |
$.get(pathtoroot + "module-search-index.zip") |
41 |
.done(function() { |
|
42 |
JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) { |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
43 |
JSZip.loadAsync(data).then(function(zip){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
44 |
zip.file("module-search-index.json").async("text").then(function(content){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
45 |
moduleSearchIndex = JSON.parse(content); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
46 |
}); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
47 |
}); |
40511 | 48 |
}); |
49 |
}); |
|
33920 | 50 |
$.get(pathtoroot + "package-search-index.zip") |
51 |
.done(function() { |
|
52 |
JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) { |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
53 |
JSZip.loadAsync(data).then(function(zip){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
54 |
zip.file("package-search-index.json").async("text").then(function(content){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
55 |
packageSearchIndex = JSON.parse(content); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
56 |
}); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
57 |
}); |
33920 | 58 |
}); |
59 |
}); |
|
60 |
$.get(pathtoroot + "type-search-index.zip") |
|
61 |
.done(function() { |
|
62 |
JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) { |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
63 |
JSZip.loadAsync(data).then(function(zip){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
64 |
zip.file("type-search-index.json").async("text").then(function(content){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
65 |
typeSearchIndex = JSON.parse(content); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
66 |
}); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
67 |
}); |
33920 | 68 |
}); |
69 |
}); |
|
70 |
$.get(pathtoroot + "member-search-index.zip") |
|
71 |
.done(function() { |
|
72 |
JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) { |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
73 |
JSZip.loadAsync(data).then(function(zip){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
74 |
zip.file("member-search-index.json").async("text").then(function(content){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
75 |
memberSearchIndex = JSON.parse(content); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
76 |
}); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
77 |
}); |
33920 | 78 |
}); |
79 |
}); |
|
80 |
$.get(pathtoroot + "tag-search-index.zip") |
|
81 |
.done(function() { |
|
82 |
JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) { |
|
52868
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
83 |
JSZip.loadAsync(data).then(function(zip){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
84 |
zip.file("tag-search-index.json").async("text").then(function(content){ |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
85 |
tagSearchIndex = JSON.parse(content); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
86 |
}); |
b4982a22926b
8214856: Errors with JSZip in web console after upgrade to 3.1.5
pmuthuswamy
parents:
52616
diff
changeset
|
87 |
}); |
33920 | 88 |
}); |
89 |
}); |
|
43370
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
90 |
if (!moduleSearchIndex) { |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
91 |
createElem(doc, tag, 'module-search-index.js'); |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
92 |
} |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
93 |
if (!packageSearchIndex) { |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
94 |
createElem(doc, tag, 'package-search-index.js'); |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
95 |
} |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
96 |
if (!typeSearchIndex) { |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
97 |
createElem(doc, tag, 'type-search-index.js'); |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
98 |
} |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
99 |
if (!memberSearchIndex) { |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
100 |
createElem(doc, tag, 'member-search-index.js'); |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
101 |
} |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
102 |
if (!tagSearchIndex) { |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
103 |
createElem(doc, tag, 'tag-search-index.js'); |
5969237f927c
8166175: javadoc search doesn't work on local doc bundles
bpatel
parents:
42831
diff
changeset
|
104 |
} |
33920 | 105 |
} |
106 |
||
107 |
function createElem(doc, tag, path) { |
|
108 |
var script = doc.createElement(tag); |
|
109 |
var scriptElement = doc.getElementsByTagName(tag)[0]; |
|
110 |
script.src = pathtoroot + path; |
|
111 |
scriptElement.parentNode.insertBefore(script, scriptElement); |
|
112 |
} |
|
113 |
||
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
47447
diff
changeset
|
114 |
function show(type) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
115 |
count = 0; |
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
47447
diff
changeset
|
116 |
for (var key in data) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
117 |
var row = document.getElementById(key); |
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
47447
diff
changeset
|
118 |
if ((data[key] & type) !== 0) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
119 |
row.style.display = ''; |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
120 |
row.className = (count++ % 2) ? rowColor : altColor; |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
121 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
122 |
else |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
123 |
row.style.display = 'none'; |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
124 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
125 |
updateTabs(type); |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
126 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
127 |
|
50167
cc705c956798
8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents:
47447
diff
changeset
|
128 |
function updateTabs(type) { |
52616
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
129 |
var firstRow = document.getElementById(Object.keys(data)[0]); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
130 |
var table = firstRow.closest('table'); |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
131 |
for (var value in tabs) { |
52616
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
132 |
var tab = document.getElementById(tabs[value][0]); |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
133 |
if (value == type) { |
52616
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
134 |
tab.className = activeTableTab; |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
135 |
tab.innerHTML = tabs[value][1]; |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
136 |
tab.setAttribute('aria-selected', true); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
137 |
tab.setAttribute('tabindex',0); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
138 |
table.setAttribute('aria-labelledby', tabs[value][0]); |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
139 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
140 |
else { |
52616
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
141 |
tab.className = tableTab; |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
142 |
tab.setAttribute('aria-selected', false); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
143 |
tab.setAttribute('tabindex',-1); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
144 |
tab.setAttribute('onclick', "show("+ value + ")"); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
145 |
tab.innerHTML = tabs[value][1]; |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
146 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
147 |
} |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
diff
changeset
|
148 |
} |
40229
09f4478d07e5
8154817: Fix the click-through navigation for modules
bpatel
parents:
35426
diff
changeset
|
149 |
|
52616
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
150 |
function switchTab(e) { |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
151 |
if (e.keyCode == 37 || e.keyCode == 38) { |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
152 |
$("[aria-selected=true]").prev().click().focus(); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
153 |
e.preventDefault(); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
154 |
} |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
155 |
if (e.keyCode == 39 || e.keyCode == 40) { |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
156 |
$("[aria-selected=true]").next().click().focus(); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
157 |
e.preventDefault(); |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
158 |
} |
1a395165c09b
8184205: Captions on tabbed tables are squashed together
pmuthuswamy
parents:
50167
diff
changeset
|
159 |
} |