Nova PhoneGap Development Process
Detailed descriptions: http://www.novasoftware.com/developer/PhoneGap.aspx.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<title></title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></script>
</head>
<body>
<p>
<input type="button" value="Render jQM" id="btnRenderjQM"/>
<input type="button" value="Render Custom" id="btnRenderCustom"/>
</p>
<p><b>Time: </b><span id="time">0</span></p>
<ul id="result" style="height: 200px; overflow: auto;"></ul>
<script language="javascript" type="text/javascript">
var time = null;
$(document).ready(function() {
var li1 = '<li data-corners="false" data-shadow="false" data-iconshadow="true" data-wrapperels="div" data-icon="arrow-r" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-icon-right ui-li-has-arrow ui-li ui-first-child ui-btn-up-c">\
<div class="ui-btn-inner ui-li">\
<div class="ui-btn-text"><a href="#" class="ui-link-inherit">Acura</a></div>\
<span class="ui-icon ui-icon-arrow-r ui-icon-shadow"> </span></div>\
</li>';
var li2 = '<li>Acura</li>';
$("#btnRenderjQM").click(function() {
var $ul = $("#result");
$ul.empty();
var html = '';
for (var i = 0; i < 1000; i++) {
html += li1;
}
time = new Date();
$ul.html(html);
$("#time").html(new Date() - time);
});
$("#btnRenderCustom").click(function() {
var $ul = $("#result");
$ul.empty();
var html = '';
for (var i = 0; i < 1000; i++) {
html += li2;
}
time = new Date();
$ul.html(html);
$("#time").html(new Date() - time);
});
});
</script>
</body>
</html>
<script src="cordova.mock.js" type="text/javascript"></script>
<script src="cordova.js" type="text/javascript"></script>
if(window.navigator == undefined) {
window.navigator = { };
}
navigator.contacts = {
find: function(contactFields, contactSuccess, contactError, contactFindOptions) {
var contacts = [
{
displayName: "Mike",
name: {
familyName: 'R',
formatted:'Mike R'
},
phoneNumbers: [
{
type: "string",
value: "0722829323123",
pref: false
}
]
},
{
displayName: "Leo",
phoneNumbers: [
{
type: "string",
value: "03837234343",
pref: false
},
{
type: "string",
value: "005543834",
pref: true
}
]
}
];
contactSuccess(contacts);
}
};
var ContactFindOptions = function() {
this.filter = "";
this.multiple = false;
};
$(document).ready(function(){
$("#btnSave").click(function(){
//todo: save the form
})
});
var ProductEditor = function(productId) {
this.productId = productId;
};
ProductEditor.prototype.save = function(callback) {
//todo: save the form
};
if(window.demo == undefined) {
demo = { };
}
if(demo.services == undefined) {
demo.services = { };
}
//define a class under the namespace
demo.services.ProductService = function () {
};
demo.services.ProductService.prototype.getProductById = function(id) {
//todo: return product
};
//to use the service
var service = new demo.services.ProductService();
var product = service.getProductById(1);
demo.services.EmailServiceProvider = function() {
this.host = "smtp.gmail.com";
this.port = 587;
};
demo.services.EmailServiceProvider.prototype.sendEmail = function(subject, body, to, cc) {
};
//define another that inherits the above provider
demo.services.ContactUsEmailServiceProvider = function() {
demo.services.EmailServiceProvider.call(this);
};
demo.services.ContactUsEmailServiceProvider.prototype = new demo.services.EmailServiceProvider();
demo.services.ContactUsEmailServiceProvider.constructor = demo.services.ContactUsEmailServiceProvider;
//override the parent method
demo.services.ContactUsEmailServiceProvider.prototype.sendEmail = function(body) {
demo.services.EmailServiceProvider.prototype.sendEmail.call(this, "contact us", body, "cail@shinetechchina.com");
};
//define new method
demo.services.ContactUsEmailServiceProvider.prototype.saveToDB = function(body) {
};