This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var date = new Date(); | |
console.log(date); | |
var dateAsString = JSON.stringify(date); | |
console.log(dateAsString); | |
var dateAsObj = new Date(JSON.parse(dateAsString)); | |
console.log(dateAsObj); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an objectStore | |
console.log("Creating objectStore") | |
dataBase.createObjectStore("elephants"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put the blob into the dabase | |
transaction.objectStore("elephants").put(blob, "image"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Telephony object | |
var tel = navigator.mozTelephony; | |
// Check if the phone is muted (read/write property) | |
console.log(tel.muted); | |
// Check if the speaker is enabled (read/write property) | |
console.log(tel.speakerEnabled); | |
// Place a call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cast = { | |
"Adm. Adama" : "Edward James Olmos", | |
"President Roslin" : "Mary McDonnell", | |
"Captain Adama" : "Jamie Bamber", | |
"Gaius Baltar" : "James Callis", | |
"Number Six" : "Tricia Helfer", | |
"Kara Thrace" : " Katee Sackhoff" | |
}; | |
// Stores the JavaScript object as a string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<figure> | |
<img id="elephant" src="about:blank" alt="A close up of an elephant"> | |
<noscript> | |
<img src="elephant.png" alt="A close up of an elephant"> | |
</noscript> | |
<figcaption>A mighty big elephant, and mighty close too!</figcaption> | |
</figure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// localStorage with image | |
var storageFiles = JSON.parse(localStorage.getItem("storageFiles")) || {}, | |
elephant = document.getElementById("elephant"), | |
storageFilesDate = storageFiles.date, | |
date = new Date(), | |
todaysDate = (date.getMonth() + 1).toString() + date.getDate().toString(); | |
// Compare date and create localStorage if it's not existing/too old | |
if (typeof storageFilesDate === "undefined" || storageFilesDate < todaysDate) { | |
// Take action when the image has loaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open a transaction to the database | |
var transaction = db.transaction(["elephants"], IDBTransaction.READ_WRITE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SMS object | |
var sms = navigator.mozSMS; | |
// Send a message | |
sms.send("123456789", "Hello world!"); | |
// Recieve a message | |
sms.onrecieved = function (event) { | |
// Read message | |
console.log(event.message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docElm = document.documentElement; | |
if (docElm.requestFullscreen) { | |
docElm.requestFullscreen(); | |
} | |
else if (docElm.mozRequestFullScreen) { | |
docElm.mozRequestFullScreen(); | |
} | |
else if (docElm.webkitRequestFullScreen) { | |
docElm.webkitRequestFullScreen(); | |
} |
OlderNewer