Projekt

Obecné

Profil

Stáhnout (5.41 KB) Statistiky
| Větev: | Tag: | Revize:
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

    
26
var moduleSearchIndex;
27
var packageSearchIndex;
28
var typeSearchIndex;
29
var memberSearchIndex;
30
var tagSearchIndex;
31
function 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
                    var zip = new JSZip(data);
44
                    zip.load(data);
45
                    moduleSearchIndex = JSON.parse(zip.file("module-search-index.json").asText());
46
                });
47
            });
48
    $.get(pathtoroot + "package-search-index.zip")
49
            .done(function() {
50
                JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) {
51
                    var zip = new JSZip(data);
52
                    zip.load(data);
53
                    packageSearchIndex = JSON.parse(zip.file("package-search-index.json").asText());
54
                });
55
            });
56
    $.get(pathtoroot + "type-search-index.zip")
57
            .done(function() {
58
                JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) {
59
                    var zip = new JSZip(data);
60
                    zip.load(data);
61
                    typeSearchIndex = JSON.parse(zip.file("type-search-index.json").asText());
62
                });
63
            });
64
    $.get(pathtoroot + "member-search-index.zip")
65
            .done(function() {
66
                JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) {
67
                    var zip = new JSZip(data);
68
                    zip.load(data);
69
                    memberSearchIndex = JSON.parse(zip.file("member-search-index.json").asText());
70
                });
71
            });
72
    $.get(pathtoroot + "tag-search-index.zip")
73
            .done(function() {
74
                JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) {
75
                    var zip = new JSZip(data);
76
                    zip.load(data);
77
                    tagSearchIndex = JSON.parse(zip.file("tag-search-index.json").asText());
78
                });
79
            });
80
    if (!moduleSearchIndex) {
81
        createElem(doc, tag, 'module-search-index.js');
82
    }
83
    if (!packageSearchIndex) {
84
        createElem(doc, tag, 'package-search-index.js');
85
    }
86
    if (!typeSearchIndex) {
87
        createElem(doc, tag, 'type-search-index.js');
88
    }
89
    if (!memberSearchIndex) {
90
        createElem(doc, tag, 'member-search-index.js');
91
    }
92
    if (!tagSearchIndex) {
93
        createElem(doc, tag, 'tag-search-index.js');
94
    }
95
    $(window).resize(function() {
96
        $('.navPadding').css('padding-top', $('.fixedNav').css("height"));
97
    });
98
}
99

    
100
function createElem(doc, tag, path) {
101
    var script = doc.createElement(tag);
102
    var scriptElement = doc.getElementsByTagName(tag)[0];
103
    script.src = pathtoroot + path;
104
    scriptElement.parentNode.insertBefore(script, scriptElement);
105
}
106

    
107
function show(type) {
108
    count = 0;
109
    for (var key in data) {
110
        var row = document.getElementById(key);
111
        if ((data[key] &  type) !== 0) {
112
            row.style.display = '';
113
            row.className = (count++ % 2) ? rowColor : altColor;
114
        }
115
        else
116
            row.style.display = 'none';
117
    }
118
    updateTabs(type);
119
}
120

    
121
function updateTabs(type) {
122
    for (var value in tabs) {
123
        var sNode = document.getElementById(tabs[value][0]);
124
        var spanNode = sNode.firstChild;
125
        if (value == type) {
126
            sNode.className = activeTableTab;
127
            spanNode.innerHTML = tabs[value][1];
128
        }
129
        else {
130
            sNode.className = tableTab;
131
            spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
132
        }
133
    }
134
}
135

    
136
function updateModuleFrame(pFrame, cFrame) {
137
    top.packageFrame.location = pFrame;
138
    top.classFrame.location = cFrame;
139
}
(13-13/17)