diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2013-08-06 13:50:37 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2013-08-06 13:50:37 -0400 |
commit | 3eb16e7cf29dde4a4c50b544f794756b6c0ae439 (patch) | |
tree | e2f562b6b6c4fb8054dfb4d55a7e977976fa395e /www/js | |
parent | 1a9a7655c0bd9fdf8d77d1763aca8b67d2264e08 (diff) | |
download | html5ks-3eb16e7cf29dde4a4c50b544f794756b6c0ae439.tar.xz html5ks-3eb16e7cf29dde4a4c50b544f794756b6c0ae439.zip |
fix stuff and such, work on unrpyc imachine
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/html5ks.js | 19 |
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); |