Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clock \& Time API test app #1

Merged
merged 2 commits into from
Aug 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": {}
}
}