Palettize Labelle.
[labelle.git] / acnl-outfit.js
index d9ef316..a09d645 100644 (file)
@@ -124,6 +124,15 @@ function litanize (names, link) {
     return names.join(names.length == 2 ? " " : ", ");        
 }
 
+function updateTime () {
+    var date = new Date();
+    document.documentElement.className = "month" + date.getMonth()
+    document.body.className = "hour" + date.getHours();
+    if (window.navigator.standalone)
+        document.body.className += " standalone";
+}
+setInterval(updateTime, 20 * 60 * 1000);
+
 function update () {
     var o = outfit();
     var wearing = document.getElementById('wearing');
@@ -137,11 +146,26 @@ function update () {
                         "Labelle suggested ",
                         "I'll wear "]) + litanize(o, false) + "."));
 
-    buttons = document.getElementById("buttons");
+    var buttons = document.getElementById("buttons");
     buttons.className = "";
     setTimeout(function () {
         buttons.className = "open";
     }, 300);
-    
-
+    updateTime();
 }
+
+window.addEventListener("DOMContentLoaded", update);
+
+window.addEventListener('load', function () {
+    if (typeof FastClick !== "undefined")
+        FastClick.attach(document.body, { tapDelay: 50 });
+
+    if (applicationCache && applicationCache.status) {
+        applicationCache.update();
+        applicationCache.addEventListener('updateready', function () {
+            if (applicationCache.status === applicationCache.UPDATEREADY) {
+                applicationCache.swapCache();
+            }
+        });
+    }
+});