aboutsummaryrefslogtreecommitdiff
path: root/website/assets/js/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'website/assets/js/script.js')
-rw-r--r--website/assets/js/script.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/website/assets/js/script.js b/website/assets/js/script.js
deleted file mode 100644
index f433de0..0000000
--- a/website/assets/js/script.js
+++ /dev/null
@@ -1,46 +0,0 @@
1// Using deployJava.runApplet to target specific element
2// from http://stackoverflow.com/questions/13517790/using-deployjava-runapplet-to-target-specific-element?answertab=active#answer-15139480
3function writeTo(func, node) {
4 var content = "";
5 var oldwrite = document.write;
6 document.write = function(add) {
7 content += add;
8 };
9 func();
10 document.write = oldwrite;
11 node.innerHTML += content;
12}
13
14function launchApplet() {
15 var attributes = {
16 code : "esieequest.Main",
17 archive : "/game/esieequest.jar"
18 };
19 var parameters = {
20 //permissions : "sandbox"
21 };
22 var version = "1.7";
23 deployJava.runApplet(attributes, parameters, version);
24}
25
26function launchGame() {
27 var wrapper = document.getElementById("play");
28 if (deployJava.versionCheck("1.7+")) {
29 writeTo(launchApplet, wrapper);
30 } else {
31 wrapper.innerHTML = '<p>Java ≥7 is required to run this game.<br>Click <a href="javascript:deployJava.installJRE()">here</a> to get the latest Java Runtime Environment.</p>';
32 }
33}
34
35// Run the applet only when the user wants to play
36// https://developer.mozilla.org/en-US/docs/Web/API/window.onhashchange
37var launched = false;
38function locationHashChanged() {
39 if (location.hash === "#play" && !launched) {
40 launched = true;
41 launchGame();
42 }
43}
44
45window.onhashchange = locationHashChanged;
46locationHashChanged();