summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-03-05 16:56:45 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-03-05 16:56:45 -0500
commit3a2f43e8d5c85a116845c360902f268fd2798ffa (patch)
tree3fb05200422ac1a544d2cd93f938b8408e21e53d /www
parent7b49a8bed0a6c8e50adba8fc6c53c39d330bfa0c (diff)
downloadhtml5ks-3a2f43e8d5c85a116845c360902f268fd2798ffa.tar.xz
html5ks-3a2f43e8d5c85a116845c360902f268fd2798ffa.zip
add (untested) php and htaccess
Diffstat (limited to 'www')
-rw-r--r--www/.htaccess25
-rw-r--r--www/index.php3
-rw-r--r--www/js/api.js17
-rw-r--r--www/warn.html2
-rw-r--r--www/warned.html1
-rw-r--r--www/warned.php2
6 files changed, 45 insertions, 5 deletions
diff --git a/www/.htaccess b/www/.htaccess
new file mode 100644
index 0000000..b51816a
--- /dev/null
+++ b/www/.htaccess
@@ -0,0 +1,25 @@
+<IfModule mod_expires.c>
+ ExpiresActive on
+ ExpiresDefault "access plus 1 minutes"
+ <Location "^/(dump|json)/">
+ ExpiresDefault "access plus 1 years"
+ <Location "^/dump/(bgm|sfx)">
+ Header set X-Content-Duration "0"
+ </Location>
+ </Location>
+</IfModule>
+
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteCond %{HTTP:Accept-Encoding} gzip
+ RewriteCond %{REQUEST_FILENAME}\.gz -s
+ RewriteRule ^(.*)\.json $1\.json\.gz [QSA]
+
+# Prevent double gzip and give the correct mime-type
+ RewriteRule \.json\.gz$ - [T=application/json,E=no-gzip:1,E=FORCE_GZIP]
+
+ Header set Content-Encoding gzip env=FORCE_GZIP
+</IfModule>
+
+Header set Cache-Control "public"
+Header set X-UA-Compatible "IE=edge,chrome=1"
diff --git a/www/index.php b/www/index.php
new file mode 100644
index 0000000..49fbbec
--- /dev/null
+++ b/www/index.php
@@ -0,0 +1,3 @@
+<?php
+if (!isset($_COOKIE["warned"])) header("Location: warn.php");
+else echo file_get_contents("index.html");
diff --git a/www/js/api.js b/www/js/api.js
index b74c1ae..1452074 100644
--- a/www/js/api.js
+++ b/www/js/api.js
@@ -50,14 +50,22 @@ window.html5ks.api = {
html5ks.spin(1);
el.oncanplaythrough = function () {
+ el.oncanplaythrough = null;
el.play();
html5ks.spin(-1);
};
+ setTimeout(function () {
+ if (el.oncanplaythrough) {
+ console.warn("video not playing after 3 seconds");
+ el.oncanplaythrough();
+ }
+ }, 3000);
+
el.onerror = function (e) {
if (e.code === e.MEDIA_ERR_SRC_NOT_SUPPORTED) {
if (_nextType(++i)) {
- console.warn("browser claimed support for " + types[i-1] + " but failed");
+ console.warn("browser claimed support for " + types[i-1][0] + " but failed");
} else {
console.error("no media formats supported");
}
@@ -153,7 +161,7 @@ window.html5ks.api = {
video.volume = html5ks.persistent.musicVolume;
var done = function () {
video.style.display = "none";
- video.pause();
+ video.src = "";
deferred.resolve();
};
document.addEventListener("keyup", function keyupListener(e) {
@@ -164,8 +172,9 @@ window.html5ks.api = {
}
}, false);
video.onclick = function (e) {
- if (e.button === 0 && skippable) {
- done();
+ if (e.button === 0) {
+ if (video.paused) video.play();
+ else if (skippable) done();
}
};
video.onended = done;
diff --git a/www/warn.html b/www/warn.html
index 8601eb7..d3ece15 100644
--- a/www/warn.html
+++ b/www/warn.html
@@ -12,7 +12,7 @@
This includes missing features, typos, downtime, and any other glitches of any sort. Bug me instead: <a href="https://bugzilla.happinessforme.com/">https://bugzilla.happinessforme.com/</a>, or use the official distribution until HTML5KS is feature-complete.
</p>
<p>FYI, this site sets a single anonymous cookie (warned=1) so that you won't have to keep seeing this page. It also sets localStorage to keep your settings and saves. The latter always stays on your computer and never goes anywhere. If you live in the EU, please don't sue me.</p>
- <form method="GET" action="warned.ngx">
+ <form method="GET" action="warned.php">
<p><input type="checkbox" name="hdisable" id="hdisable"><label for="hdisable">Disable adult content</label>
<br>
<input type="submit" value="Let's go!">
diff --git a/www/warned.html b/www/warned.html
index 5d44d7c..99779ed 100644
--- a/www/warned.html
+++ b/www/warned.html
@@ -1,6 +1,7 @@
<!DOCTYPE html>
<html><head>
<script>
+document.cookie = "warned=1; Expires=Tue, 19 Jan 2038 00:00:00 GMT; HttpOnly";
localStorage.persistent = {
hdisable: location.search.indexOf("hdisable=on") > -1,
language: location.search.search("language=.*[=,]en") > -1 ? "en" : "fr"
diff --git a/www/warned.php b/www/warned.php
new file mode 100644
index 0000000..04c300b
--- /dev/null
+++ b/www/warned.php
@@ -0,0 +1,2 @@
+<?php
+header("Location: /warned.html?".$_SERVER['QUERY_STRING']."&language=".$_SERVER['HTTP_ACCEPT_LANGUAGE']);