1/* 2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. 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 26var moduleSearchIndex; 27var packageSearchIndex; 28var typeSearchIndex; 29var memberSearchIndex; 30var tagSearchIndex; 31function loadScripts(doc, tag) { 32 createElem(doc, tag, 'jquery/jszip/dist/jszip.js'); 33 createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js'); 34 if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 || 35 window.navigator.userAgent.indexOf('Edge/') > 0) { 36 createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js'); 37 } 38 createElem(doc, tag, 'search.js'); 39 40 $.get(pathtoroot + "module-search-index.zip") 41 .done(function() { 42 JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) { 43 JSZip.loadAsync(data).then(function(zip){ 44 zip.file("module-search-index.json").async("text").then(function(content){ 45 moduleSearchIndex = JSON.parse(content); 46 }); 47 }); 48 }); 49 }); 50 $.get(pathtoroot + "package-search-index.zip") 51 .done(function() { 52 JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) { 53 JSZip.loadAsync(data).then(function(zip){ 54 zip.file("package-search-index.json").async("text").then(function(content){ 55 packageSearchIndex = JSON.parse(content); 56 }); 57 }); 58 }); 59 }); 60 $.get(pathtoroot + "type-search-index.zip") 61 .done(function() { 62 JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) { 63 JSZip.loadAsync(data).then(function(zip){ 64 zip.file("type-search-index.json").async("text").then(function(content){ 65 typeSearchIndex = JSON.parse(content); 66 }); 67 }); 68 }); 69 }); 70 $.get(pathtoroot + "member-search-index.zip") 71 .done(function() { 72 JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) { 73 JSZip.loadAsync(data).then(function(zip){ 74 zip.file("member-search-index.json").async("text").then(function(content){ 75 memberSearchIndex = JSON.parse(content); 76 }); 77 }); 78 }); 79 }); 80 $.get(pathtoroot + "tag-search-index.zip") 81 .done(function() { 82 JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) { 83 JSZip.loadAsync(data).then(function(zip){ 84 zip.file("tag-search-index.json").async("text").then(function(content){ 85 tagSearchIndex = JSON.parse(content); 86 }); 87 }); 88 }); 89 }); 90 if (!moduleSearchIndex) { 91 createElem(doc, tag, 'module-search-index.js'); 92 } 93 if (!packageSearchIndex) { 94 createElem(doc, tag, 'package-search-index.js'); 95 } 96 if (!typeSearchIndex) { 97 createElem(doc, tag, 'type-search-index.js'); 98 } 99 if (!memberSearchIndex) { 100 createElem(doc, tag, 'member-search-index.js'); 101 } 102 if (!tagSearchIndex) { 103 createElem(doc, tag, 'tag-search-index.js'); 104 } 105 $(window).resize(function() { 106 $('.navPadding').css('padding-top', $('.fixedNav').css("height")); 107 }); 108} 109 110function createElem(doc, tag, path) { 111 var script = doc.createElement(tag); 112 var scriptElement = doc.getElementsByTagName(tag)[0]; 113 script.src = pathtoroot + path; 114 scriptElement.parentNode.insertBefore(script, scriptElement); 115} 116 117function show(type) { 118 count = 0; 119 for (var key in data) { 120 var row = document.getElementById(key); 121 if ((data[key] & type) !== 0) { 122 row.style.display = ''; 123 row.className = (count++ % 2) ? rowColor : altColor; 124 } 125 else 126 row.style.display = 'none'; 127 } 128 updateTabs(type); 129} 130 131function updateTabs(type) { 132 for (var value in tabs) { 133 var sNode = document.getElementById(tabs[value][0]); 134 var spanNode = sNode.firstChild; 135 if (value == type) { 136 sNode.className = activeTableTab; 137 spanNode.innerHTML = tabs[value][1]; 138 } 139 else { 140 sNode.className = tableTab; 141 spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>"; 142 } 143 } 144} 145 146function updateModuleFrame(pFrame, cFrame) { 147 top.packageFrame.location = pFrame; 148 top.classFrame.location = cFrame; 149} 150