ndt-dev - [ndt-dev] [ndt] r1129 committed - Added flash/java plugin detection on JS UI page
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r1129 committed - Added flash/java plugin detection on JS UI page
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r1129 committed - Added flash/java plugin detection on JS UI page
- Date: Wed, 06 Aug 2014 05:22:30 +0000
Revision: 1129
Author:
Date: Wed Aug 6 05:22:03 2014 UTC
Log: Added flash/java plugin detection on JS UI page
http://code.google.com/p/ndt/source/detail?r=1129
Modified:
/branches/Issue154/HTML5-frontend/script.js
/branches/Issue154/HTML5-frontend/style.css
/branches/Issue154/HTML5-frontend/widget.html
=======================================
--- /branches/Issue154/HTML5-frontend/script.js Wed Jun 18 06:12:24 2014 UTC
+++ /branches/Issue154/HTML5-frontend/script.js Wed Aug 6 05:22:03 2014 UTC
@@ -5,11 +5,10 @@
setTimeout(initializeTest, 1000);
return;
}
+ checkInstalledPlugins();
initializeTest();
});
-
-
// CONSTANTS
// Testing phases
@@ -57,6 +56,8 @@
function startTest(evt) {
evt.stopPropagation();
evt.preventDefault();
+ document.getElementById('javaButton').disabled = true;
+ document.getElementById('flashButton').disabled = true;
showPage('test', resetGauges);
document.getElementById('rttValue').innerHTML = "";
if (simulate) return simulateTest();
@@ -196,6 +197,8 @@
document.getElementById('jitter').innerHTML = jitter().toPrecision(2);
document.getElementById("test-details").innerHTML = testDetails();
document.getElementById("test-advanced").appendChild(testDiagnosis());
+ document.getElementById('javaButton').disabled = false;
+ document.getElementById('flashButton').disabled = false;
showPage('results');
break;
@@ -467,6 +470,39 @@
return d;
}
+// BACKEND METHODS
+function useJavaAsBackend() {
+ //document.getElementById('javaButton').toggleClass('active');
+ var backendContainer = document.getElementById('backendContainer');
+ while (backendContainer.firstChild) {
+ backendContainer.removeChild(backendContainer.firstChild);
+ }
+
+ var app = document.createElement('applet');
+ app.id = 'NDT';
+ app.name = 'NDT';
+ app.archive = 'Tcpbw100.jar';
+ app.code = 'edu.internet2.ndt.Tcpbw100.class';
+ app.width = '400';
+ app.height = '400';
+ document.getElementById('backendContainer').appendChild(app);
+}
+
+function useFlashAsBackend() {
+ var backendContainer = document.getElementById('backendContainer');
+ while (backendContainer.firstChild) {
+ backendContainer.removeChild(backendContainer.firstChild);
+ }
+
+ var embed = document.createElement('embed');
+ embed.id = 'NDT';
+ embed.name = 'NDT';
+ embed.type = 'application/x-shockwave-flash';
+ embed.src = 'FlashClt.swf';
+ embed.width = '600';
+ embed.height = '400';
+ document.getElementById('backendContainer').appendChild(embed);
+}
// UTILITIES
@@ -474,3 +510,27 @@
if (allowDebug && window.console) console.debug(message);
}
+function checkInstalledPlugins() {
+ var hasFlash = false, hasJava = false;
+ try {
+ var activeXObject = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
+ if(activeXObject) hasFlash = true;
+ } catch(e) {
+ if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
+ }
+
+ if (!hasFlash) {
+ document.getElementById('flashButton').disabled = true
+ }
+
+ if (deployJava.getJREs() == '') {
+ document.getElementById('javaButton').disabled = true;
+ } else {
+ hasJava = true;
+ }
+
+ if (hasJava) {
+ useJavaAsBackend();
+ }
+}
+
=======================================
--- /branches/Issue154/HTML5-frontend/style.css Wed Jun 18 06:12:24 2014 UTC
+++ /branches/Issue154/HTML5-frontend/style.css Wed Aug 6 05:22:03 2014 UTC
@@ -90,6 +90,22 @@
.controls .button {
-moz-box-shadow: 0 3px 5px #000;
}
+
+.backendButton {
+ width: 200px;
+ height: 50px;
+ font-size: 24px;
+ margin: 10px;
+}
+
+.backendButton .active {
+ background-color:blue;
+}
+
+.backendButton:disabled {
+ background-color:gray;
+ cursor: default;
+}
/* Welcome page */
=======================================
--- /branches/Issue154/HTML5-frontend/widget.html Wed Jun 18 06:12:24 2014 UTC
+++ /branches/Issue154/HTML5-frontend/widget.html Wed Aug 6 05:22:03 2014 UTC
@@ -10,6 +10,7 @@
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="gauge.min.js"></script>
<script type="text/javascript" src="script.js"></script>
+ <script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var simulate = false;
var allowDebug = false;
@@ -122,11 +123,17 @@
</div>
</div>
-<!--Use embed tag to have flash client being background for JS UI or applet tag if you want to use java applet instead. -->
-<applet id="NDT" name="NDT" code="edu.internet2.ndt.Tcpbw100.class" codebase="<?php print $applet_url ?>" archive="Tcpbw100.jar" width="400" height="400"></applet>
+<div>
+ <button id="javaButton" class="backendButton button" onclick="useJavaAsBackend()" type="button">Use java</button>
+ <button id="flashButton" class="backendButton button" onclick="useFlashAsBackend()" type="button">Use flash</button>
+</div>
-<!--<embed id="NDT" name="NDT" type="application/x-shockwave-flash" src="FlashClt.swf" width="600" height="400" />-->
+<div id="backendContainer">
+ <!--Use embed tag to have flash client being background for JS UI or applet tag if you want to use java applet instead. -->
+ <embed id="NDT" name="NDT" type="application/x-shockwave-flash" src="FlashClt.swf" width="600" height="400" />
+ <!--<applet id="NDT" name="NDT" code="edu.internet2.ndt.Tcpbw100.class" codebase="<?php print $applet_url ?>" archive="Tcpbw100.jar" width="400" height="400"></applet>-->
+</div>
</body>
</html>
- [ndt-dev] [ndt] r1129 committed - Added flash/java plugin detection on JS UI page, ndt, 08/06/2014
Archive powered by MHonArc 2.6.16.