Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (61 sloc) 2.27 KB
<!DOCTYPE html>
<html>
<head>
<title>Cordova Notification Example</title>
<link rel="stylesheet" href="/vendor/ionic/css/ionic.css" />
<link rel="stylesheet" href="/stylesheets/application.css" />
<!-- cordova.js is served from localhost to ensure the correct version -->
<script src="http://localhost/cordova.js"></script>
<script src="/components/steroids-js/steroids.js"></script>
<script src="/javascripts/application.js"></script>
<script>
function alertDismissed() {
console.log("Alert dismissed!");
}
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
function confirmDismissed(buttonIndex) {
console.log("User selected button number " + buttonIndex);
}
function showConfirm() {
navigator.notification.confirm(
'You are the winner!', // message
confirmDismissed, // callback
'Game Over', // title
'Restart,Exit' // buttonLabels
);
}
function promptDismissed(results) {
console.log("User selected button number " + results.buttonIndex + " and entered the text " + results.input1);
}
function showPrompt() {
navigator.notification.prompt(
'Please enter your name', // message
promptDismissed, // callback
'Registration', // title
['Ok','Exit'], // buttonLabels
'Dolan Duck' // defaultText
);
}
function vibrate() {
// Vibration duration set in milliseconds
navigator.notification.vibrate(500);
}
</script>
</head>
<body class="content">
<div class="padding">
<h1>Notification Examples</h1>
<button class="button button-block" ontouchend="showAlert()">Show alert dialogue</button>
<button class="button button-block" ontouchend="showConfirm()">Show confirm dialogue</button>
<button class="button button-block" ontouchend="showPrompt()">Show prompt dialogue</button>
<button class="button button-block" ontouchend="vibrate()">Vibrate the device</button>
</div>
</body>
</html>