summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/html5ks.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index 11cbf78..f97a1f0 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -6,12 +6,13 @@ window.html5ks = {
persistent: {},
init: function () {
var defaultPersistent = {
+ version: 0,
fade: 100,
gotit: false,
hdisable: false,
skipUnread: false,
skipAfterChoices: false,
- useWebP: null,
+ useWebP: false,
fullscreen: false,
scaleAll: true,
scaleVideo: true,
@@ -23,6 +24,7 @@ window.html5ks = {
language: "en"
};
var loaded = localStorage.persistent ? JSON.parse(localStorage.persistent) : {};
+ html5ks.state._loaded = typeof loaded.version !== undefined;
var defProp = function (v) {
Object.defineProperty(html5ks.persistent, k, {
get: function () {
@@ -38,6 +40,18 @@ window.html5ks = {
for (var k in defaultPersistent) {
defProp(typeof loaded[k] === "undefined" ? defaultPersistent[k] : loaded[k]);
}
+
+ document.addEventListener("DOMContentLoaded", function () {
+ html5ks.onload();
+ }, false);
+
+ if (html5ks.state._loaded) {
+ var img = new Image();
+ img.onload = function () {
+ html5ks.persistent.useWebP = img.width === 4;
+ };
+ img.src = 'data:image/webp;base64,UklGRjgAAABXRUJQVlA4ICwAAAAQAgCdASoEAAQAAAcIhYWIhYSIgIIADA1gAAUAAAEAAAEAAP7%2F2fIAAAAA';
+ }
},
store: {
seen_scenes: {},
@@ -248,6 +262,3 @@ window.html5ks = {
}
};
html5ks.init();
-document.addEventListener("DOMContentLoaded", function () {
- html5ks.onload();
-}, false);