generator-steroids
Version:
A Yeoman generator for Steroids
78 lines (63 loc) • 2.37 kB
HTML
<html>
<head>
<title>Cordova Notification Example</title>
<link rel="stylesheet" href="vendor/topcoat/css/topcoat-mobile-light.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>
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>
<div class="content-padded">
<h1>Notification Examples</h1>
<div class="topcoat-button--cta center full" ontouchend="showAlert()">Show alert dialogue</div>
<br><br>
<div class="topcoat-button center full" ontouchend="showConfirm()">Show confirm dialogue</div>
<br><br>
<div class="topcoat-button center full" ontouchend="showPrompt()">Show prompt dialogue</div>
<br><br>
<div class="topcoat-button center full" ontouchend="vibrate()">Vibrate the device</div>
</div>
</body>
</html>