This presentation is an HTML5 website
Press -> key to advance.
Zoom in/out: Ctrl or Command + +/-
Having issues seeing the presentation? Read the disclaimer
<html manifest="timer.manifest">timer.manifest:
CACHE MANIFEST timer.html timer.css timer.js.htaccess:
AddType text/cache-manifest manifest
CACHE MANIFEST # version 17.0.1 CACHE: stockApp.html stockApp.js stockApp.css FALLBACK: /stocks/* sorry.html NETWORK: /prices/*
alert(window.applicationCache.status);
window.applicationCache.addEventListener("cached", onAppCached, false);
Initiate downloading
window.applicationCache.update();"Hot swap" the cache
window.applicationCache.swapCache();
var username = document.querySelector('#username');
// place content from previous edit
if (!username.value) {
var keyValues = document.cookie.split(";");
for (var i=0; i<keyValues.length; i++) {
var keyValue=keyValues[i].split('=');
if (keyValue[0].replace(/^ +/,"")=='value') username.value = keyValue[1];
}
}
// save content in cookie
username.addEventListener('keyup', function () {
document.cookie = 'value='+username.value;
console.log(document.cookie, "--", username, username.value);
}, false);
Use case: Save username
// use localStorage for persistent storage
// use sessionStorage for per tab storage
var area = document.getElementById("area");
area.addEventListener('keyup', function () {
localStorage['value'] = area.value;
}, false);
area.value = localStorage['value'];
Crash-Safe Mail Client: Save drafts locally
html5rocks.webdb.db = openDatabase("Todo", "1.0", "Todo manager", dbSize);
db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS todo(ID INTEGER PRIMARY KEY ASC,
todo TEXT, added_on DATETIME)", []);
tx.executeSql("INSERT INTO todo(todo, added_on) VALUES (?,?)",
[todoText, addedOn], function() {
html5rocks.webdb.showAllTodoItems(loadTodoItems); // success
}, html5rocks.webdb.onError); //failure
});
var db = indexedDB.open('tweets', 'Tweet store', false);
db.createObjectStore('tweets', 'id'); // 'id' is the key
db.createIndex('ByScreenname', 'tweets', 'screen_name', false);
var store = db.openObjectStore('tweets');
var objKey = store.put({id: 12345667, text: 'Hello World', screen_name: "Joe"});
var index = db.openIndex('ByScreenname');
var matching = index.get('Joe');
if (matching) {
report(matching.id, matching.screen_name, matching.text);
}
document.getElementById("images").onchange = function(ev) {
for (var i=0; i<this.files.length; i++) {
(function(file) {
var fileReader = new FileReader();
fileReader.onloadend = function() {
var img = document.createElement("img");
img.src = fileReader.result;
document.body.appendChild(img);
};
fileReader.readAsDataURL(file);
})(this.files[i]);
}
}
<input type="file" id="images" multiple></p>
Offline:
And On:
Feedback: @mahemoff / mahemoff@google.com
http://www.flickr.com/photos/anirudhkoul/2632880868/sizes/l/in/photostream/ http://www.flickr.com/photos/hendry/3000417490/sizes/l/in/photostream/ http://www.flickr.com/photos/pmiaki/3759228220/sizes/l/in/photostream/ http://www.flickr.com/photos/odalaigh/2625502285/sizes/l/in/photostream/ http://www.baixaki.com.br/download/mugtug-darkroom.htm http://www.flickr.com/photos/gmacorig/1809288965/sizes/l/in/photostream/ http://www.flickr.com/photos/plutor/1818329845/sizes/l/in/photostream/ http://www.flickr.com/photos/plutor/1818329845/sizes/l/in/photostream/ http://www.flickr.com/photos/96814934@N00/3285550219/sizes/m/in/photostream/ http://www.flickr.com/photos/37184970@N00/5017980645/sizes/l/in/photostream/ http://www.flickr.com/photos/gmacorig/1809288965/sizes/l/in/photostream/ http://www.flickr.com/photos/esti/147733640/sizes/l/in/photostream/ http://www.flickr.com/photos/37184970@N00/4987958271/sizes/o/in/photostream/ http://www.flickr.com/photos/37184970@N00/5018608514/sizes/l/in/photostream/ http://www.flickr.com/photos/eyesplash/4332397307/sizes/l/in/photostream/