Skip to content

Commit

Permalink
Merge pull request #1 from Ephemera/master
Browse files Browse the repository at this point in the history
Add Clock \& Time API test app
  • Loading branch information
channy committed Aug 7, 2013
2 parents d57a19f + c6101f6 commit cbe537c
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Time_Clock/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title></title>
</head>
<body>
<input type="date" name="" id="date" value="">
<input type="time" name="" id="time" value="">
<button id="set">set</button>
<input type="text" id="now" value="" readonly>
<script type="text/javascript">
(function(){
'use strict';

var dt = {
year: '',
month: '',
day: '',
hour: '',
minute: ''
};

setInterval(function() {
document.getElementById('now').value = new Date();
}, 1000)

function setTime(time) {
navigator.mozTime.set(time);
}

window.addEventListener('moztimechange', function() {
console.log('changed');
});

document.getElementById('date').addEventListener('blur', function(ev) {
var val = this.value.split(/\D/);
dt.year = val[0];
dt.month = --val[1];
dt.day = val[2];
});

document.getElementById('time').addEventListener('blur', function(ev) {
var val = this.value.split(/\D/);
dt.hour = val[0];
dt.minute = val[1];
});

document.getElementById('set').addEventListener('click', function(ev) {
setTime(new Date(dt.year, dt.month, dt.day, dt.hour, dt.minute));
});

})();
</script>
</body>
</html>
17 changes: 17 additions & 0 deletions Time_Clock/manifest.webapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Time_Clock",
"description": "Time & Clock API test app",
"launch_path": "/index.html",
"icons": {
"128": "nothing.png"
},
"developer": {
"name": "고윤지, 변상필, 정규용",
"url": ""
},
"default_locale": "ko",
"type": "certified",
"permissions": {
"time": {}
}
}

0 comments on commit cbe537c

Please sign in to comment.