aboutsummaryrefslogtreecommitdiff
path: root/website/assets/js
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2014-02-22 18:57:47 +0100
committerPacien TRAN-GIRARD2014-02-22 18:57:47 +0100
commitc80a22f026af465bee8bc88fd7058693c327e216 (patch)
treea61ecd4c8ec0576bf039395b6f0d1c4dc0b138d5 /website/assets/js
parentae9f87673c956804837abe6a3c8e7c2450c62223 (diff)
downloadesieequest-c80a22f026af465bee8bc88fd7058693c327e216.tar.gz
Embed applet in the website
Diffstat (limited to 'website/assets/js')
-rw-r--r--website/assets/js/deployJava.js1305
-rw-r--r--website/assets/js/script.js48
2 files changed, 1353 insertions, 0 deletions
diff --git a/website/assets/js/deployJava.js b/website/assets/js/deployJava.js
new file mode 100644
index 0000000..879df1c
--- /dev/null
+++ b/website/assets/js/deployJava.js
@@ -0,0 +1,1305 @@
1/*
2 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
3 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * - Neither the name of Oracle nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * deployJava.js
35 *
36 * This file is part of the Deployment Toolkit. It provides functions for web
37 * pages to detect the presence of a JRE, install the latest JRE, and easily run
38 * applets or Web Start programs. More Information on usage of the
39 * Deployment Toolkit can be found in the Deployment Guide at:
40 * http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/index.html
41 *
42 * The "live" copy of this file may be found at :
43 * http://java.com/js/deployJava.js.
44 * For web pages provisioned using https, you may want to access the copy at:
45 * https://java.com/js/deployJava.js.
46 *
47 * You are encouraged to link directly to the live copies.
48 * The above files are stripped of comments and whitespace for performance,
49 * You can access this file w/o the whitespace and comments removed at:
50 * http://java.com/js/deployJava.txt.
51 *
52 */
53
54var deployJava = function() {
55 /** HTML attribute filter implementation */
56 var hattrs = {
57 core: [ 'id', 'class', 'title', 'style' ],
58 i18n: [ 'lang', 'dir' ],
59 events: [ 'onclick', 'ondblclick', 'onmousedown', 'onmouseup',
60 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress',
61 'onkeydown', 'onkeyup' ],
62 applet: [ 'codebase', 'code', 'name', 'archive', 'object',
63 'width', 'height', 'alt', 'align', 'hspace', 'vspace' ],
64 object: [ 'classid', 'codebase', 'codetype', 'data', 'type',
65 'archive', 'declare', 'standby', 'height', 'width', 'usemap',
66 'name', 'tabindex', 'align', 'border', 'hspace', 'vspace' ]
67 };
68
69 var object_valid_attrs = hattrs.object.concat(hattrs.core, hattrs.i18n,
70 hattrs.events);
71 var applet_valid_attrs = hattrs.applet.concat(hattrs.core);
72
73 // generic log function, use console.log unless it isn't available
74 // then revert to alert()
75 function log(message) {
76 if ( ! rv.debug ) {return};
77
78 if (console.log) {
79 console.log(message);
80 } else {
81 alert(message);
82 }
83 }
84
85 //checks where given version string matches query
86 //
87 //NB: assume format is correct. Can add format check later if needed
88 // from dtjava.js
89 function versionCheckEx(query, version) {
90 if (query == null || query.length == 0) return true;
91
92 var c = query.charAt(query.length - 1);
93
94 //if it is not explicit pattern but does not have update version then need to append *
95 if (c != '+' && c != '*' && (query.indexOf('_') != -1 && c != '_')) {
96 query = query + "*";
97 c = '*';
98 }
99
100 query = query.substring(0, query.length - 1);
101 //if query ends with ".", "_" then we want to strip it to allow match of "1.6.*" to shorter form such as "1.6"
102 //TODO: add support for match of "1.7.0*" to "1.7"?
103 if (query.length > 0) {
104 var z = query.charAt(query.length - 1);
105 if (z == '.' || z == '_') {
106 query = query.substring(0, query.length - 1);
107 }
108 }
109 if (c == '*') {
110 //it is match if version starts from it
111 return (version.indexOf(query) == 0);
112 } else if (c == '+') {
113 //match if query string is lexicographically smaller
114 return query <= version;
115 }
116 return false;
117 }
118
119 function getWebStartLaunchIconURL() {
120 var imageUrl = '//java.com/js/webstart.png';
121 try {
122 // for http/https; use protocol less url; use http for all other protocol
123 return document.location.protocol.indexOf('http') != -1 ?
124 imageUrl : 'http:' + imageUrl;
125 } catch (err) {
126 return 'http:' + imageUrl;
127 }
128 }
129
130 // GetJava page
131 function constructGetJavaURL(query) {
132
133 var getJavaURL = 'http://java.com/dt-redirect';
134
135 if (query == null || query.length == 0) return getJavaURL;
136 if(query.charAt(0) == '&')
137 {
138 query = query.substring(1, query.length);
139 }
140 return getJavaURL + '?'+ query;
141 }
142
143 function arHas(ar, attr) {
144 var len = ar.length;
145 for (var i = 0; i < len; i++) {
146 if (ar[i] === attr) return true;
147 }
148 return false;
149 }
150
151 function isValidAppletAttr(attr) {
152 return arHas(applet_valid_attrs, attr.toLowerCase());
153 }
154
155 function isValidObjectAttr(attr) {
156 return arHas(object_valid_attrs, attr.toLowerCase());
157 }
158
159 /**
160 * returns true if we can enable DT plugin auto-install without chance of
161 * deadlock on cert mismatch dialog
162 *
163 * requestedJREVersion param is optional - if null, it will be
164 * treated as installing any JRE version
165 *
166 * DT plugin for 6uX only knows about JRE installer signed by SUN cert.
167 * If it encounter Oracle signed JRE installer, it will have chance of
168 * deadlock when running with IE. This function is to guard against this.
169 */
170 function enableWithoutCertMisMatchWorkaround(requestedJREVersion) {
171
172 // Non-IE browser are okay
173 if ('MSIE' != deployJava.browserName) return true;
174
175 // if DT plugin is 10.0.0 or above, return true
176 // This is because they are aware of both SUN and Oracle signature and
177 // will not show cert mismatch dialog that might cause deadlock
178 if (deployJava.compareVersionToPattern(deployJava.getPlugin().version,
179 ["10", "0", "0"], false, true)) {
180 return true;
181 }
182
183 // If we got there, DT plugin is 6uX
184
185 if (requestedJREVersion == null) {
186 // if requestedJREVersion is not defined - it means ANY.
187 // can not guarantee it is safe to install ANY version because 6uX
188 // DT does not know about Oracle certificates and may deadlock
189 return false;
190 }
191
192 // 6u32 or earlier JRE installer used Sun certificate
193 // 6u33+ uses Oracle's certificate
194 // DT in JRE6 does not know about Oracle certificate => can only
195 // install 6u32 or earlier without risk of deadlock
196 return !versionCheckEx("1.6.0_33+", requestedJREVersion);
197 }
198
199 /* HTML attribute filters */
200
201 var rv = {
202
203 debug: null,
204
205 /* version of deployJava.js */
206 version: "20120801",
207
208 firefoxJavaVersion: null,
209
210 myInterval: null,
211 preInstallJREList: null,
212 returnPage: null,
213 brand: null,
214 locale: null,
215 installType: null,
216
217 EAInstallEnabled: false,
218 EarlyAccessURL: null,
219
220
221 // mime-type of the DeployToolkit plugin object
222 oldMimeType: 'application/npruntime-scriptable-plugin;DeploymentToolkit',
223 mimeType: 'application/java-deployment-toolkit',
224
225 /* location of the Java Web Start launch button graphic is right next to
226 * deployJava.js at:
227 * http://java.com/js/webstart.png