Cyranicus commited on
Commit
3e3474c
1 Parent(s): 9ad946b

Delete uph_ArmorGamesIntro.js

Browse files
Files changed (1) hide show
  1. uph_ArmorGamesIntro.js +0 -70
uph_ArmorGamesIntro.js DELETED
@@ -1,70 +0,0 @@
1
- var donePlayingIntro = false;
2
-
3
- /**
4
- * Play the Armor Games intro
5
- * @param {string} windowHandleName Index of the canvas element
6
- * @param {string} directory Directory to find the armor games intros in. A / will be automatically added
7
- */
8
- function playIntro(windowHandleName, directory) {
9
- var windowHandle = document.getElementById(windowHandleName);
10
-
11
- donePlayingIntro = false;
12
-
13
- var videoElementA = document.createElement("a");
14
- videoElementA.style.textDecoration = "none";
15
- videoElementA.href = "http://armor.ag/MoreGames";
16
- videoElementA.target = "_blank";
17
-
18
- var videoElement = document.createElement("video");
19
- if (videoElement.canPlayType("video/ogg")) {
20
- videoElement.setAttribute("src", directory + "/armorIntro.ogv");
21
- } else if (videoElement.canPlayType("video/x-m4v")) {
22
- videoElement.setAttribute("src", directory + "/armorIntro.m4v");
23
- } else if (videoElement.canPlayType("video/webm")) {
24
- videoElement.setAttribute("src", directory + "/armorIntro.webm");
25
- } else {
26
- console.log("Cannot play Armor Games intro, skipping!");
27
- donePlayingIntro = true;
28
- }
29
-
30
- videoElement.setAttribute("width", windowHandle.width);
31
- videoElement.setAttribute("height", windowHandle.height);
32
- videoElement.style.backgroundColor = "black";
33
- videoElement.style.position = "fixed";
34
- var rect = windowHandle.getBoundingClientRect();
35
- videoElement.style.left = rect.left + "px";
36
- videoElement.style.top = rect.top + "px";
37
- var promise = videoElement.play();
38
- if (promise !== undefined) {
39
- promise.catch(function(err) {
40
- videoElement.muted = true;
41
- promise = videoElement.play();
42
- promise.catch(function(err) {
43
- //Failed, skip the intro
44
- finalizeIntro();
45
- });
46
- });
47
- }
48
-
49
- videoElement.addEventListener("ended", function() {
50
- finalizeIntro();
51
- });
52
- videoElementA.appendChild(videoElement);
53
- document.body.appendChild(videoElementA);
54
-
55
- /**
56
- * Finalize the intro animation.
57
- */
58
- function finalizeIntro() {
59
- document.body.removeChild(videoElementA);
60
- donePlayingIntro = true;
61
- videoElement = null;
62
- }
63
- }
64
-
65
- /**
66
- * Whether we're done playing the armor games intro
67
- */
68
- function hasPlayedIntro() {
69
- return donePlayingIntro;
70
- }