Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

main.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. var deviceInfo = function() {
  2. document.getElementById("platform").innerHTML = device.platform;
  3. document.getElementById("version").innerHTML = device.version;
  4. document.getElementById("uuid").innerHTML = device.uuid;
  5. document.getElementById("name").innerHTML = device.name;
  6. document.getElementById("width").innerHTML = screen.width;
  7. document.getElementById("height").innerHTML = screen.height;
  8. document.getElementById("colorDepth").innerHTML = screen.colorDepth;
  9. };
  10. var getContacts = function () {
  11. function onSuccess(contacts) {
  12. for (var i = 0; i < navigator.contacts.length; i++) {
  13. for (var j = 0; j < contacts[i].addresses.length; j++) {
  14. alert("Name: " + contacts[i].name + "\n" +
  15. "Phone: " + contacts[i].phoneNumbers[j].pref + "\n" );
  16. }
  17. }
  18. };
  19. function onError(contactError) {
  20. alert('onError!');
  21. };
  22. // find all contacts that have phone number
  23. var options = new ContactFindOptions();
  24. options.hasPhoneNumber = true;
  25. var fields = [navigator.contacts.fieldType.name];
  26. navigator.contacts.find(fields, onSuccess, onError, options);
  27. };
  28. function init() {
  29. // the next line makes it impossible to see Contacts on the HTC Evo since it
  30. // doesn't have a scroll button
  31. // document.addEventListener("touchmove", preventBehavior, false);
  32. document.addEventListener("deviceready", deviceInfo, true);
  33. }