mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-01-14 16:58:03 -05:00
68 lines
2.6 KiB
HTML
68 lines
2.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Globalization Example</title>
|
|
|
|
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.5.1.min.js"></script>
|
|
<script type="text/javascript" charset="utf-8" src="Globalization.js"></script>
|
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
// Wait for PhoneGap to load
|
|
//
|
|
function onLoad() {
|
|
document.addEventListener("deviceready", onDeviceReady, false);
|
|
}
|
|
|
|
// PhoneGap is ready
|
|
//
|
|
function onDeviceReady() {
|
|
|
|
console.log("onDeviceReady fired");
|
|
|
|
}
|
|
function getLocale() {
|
|
window.plugins.globalization.getLocaleName(
|
|
function (locale) {alert('locale:' + locale.value + '\n');},
|
|
function () {console.log("error getting locale");}
|
|
);
|
|
}
|
|
function getDate() {
|
|
window.plugins.globalization.dateToString(new Date(),
|
|
function (date) {alert('date:' + date.value + '\n');},
|
|
function (errorCode) {alert(errorCode);},
|
|
{formatLength:'short'});
|
|
}
|
|
function getDatePattern() {
|
|
window.plugins.globalization.getDatePattern(
|
|
function (date) { alert('pattern:' + date.pattern + '\n'); },
|
|
function () {console.log("error getting date pattern");},
|
|
{formatLength:'short'});
|
|
}
|
|
function isDayLightSavings() {
|
|
window.plugins.globalization.isDayLightSavingsTime(new Date(),
|
|
function (date) {alert('dst:' + date.dst + '\n');},
|
|
function () { console.log("error getting daylight savings value"); }
|
|
);
|
|
|
|
}
|
|
function getNumberPattern() {
|
|
window.plugins.globalization.getNumberPattern(
|
|
function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
|
|
function () {console.log("error getting number pattern");});
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>Globalization</h1>
|
|
<div><button onclick="getLocale();">Get Locale</button></div>
|
|
<div><button onclick="getDate();">Get Date</button></div>
|
|
<div><button onclick="getDatePattern();">Get Date Pattern</button></div>
|
|
<div><button onclick="getNumberPattern();">Get Number Pattern</button></div>
|
|
<div><button onclick="isDayLightSavings();">Is Daylight savings?</button></div>
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|