index.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <!-- Change this if you want to allow scaling -->
  5. <meta name="viewport" content="width=default-width; user-scalable=no" />
  6. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  7. <title>paypal-plugin-host</title>
  8. <!-- iPad/iPhone specific css below, add after your main css >
  9. <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
  10. <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
  11. -->
  12. <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
  13. <script type="text/javascript" charset="utf-8" src="SAiOSKeychainPlugin.js"></script>
  14. <script type="text/javascript" charset="utf-8">
  15. // If you want to prevent dragging, uncomment this section
  16. /*
  17. function preventBehavior(e)
  18. {
  19. e.preventDefault();
  20. };
  21. document.addEventListener("touchmove", preventBehavior, false);
  22. */
  23. function onBodyLoad()
  24. {
  25. document.addEventListener("deviceready", onDeviceReady,false);
  26. }
  27. /* When this function is called, PhoneGap has been initialized and is ready to roll */
  28. function onDeviceReady()
  29. {
  30. try {
  31. // do your thing!
  32. } catch (e) {
  33. debug.error(e);
  34. }
  35. }
  36. function onGet()
  37. {
  38. var key = document.getElementById("keytoget").value;
  39. var servicename = document.getElementById("servicename").value
  40. var win = function(key, value) {
  41. alert("GET SUCCESS - Key: " + key + " Value: " + value);
  42. };
  43. var fail = function(key, error) {
  44. alert("GET FAIL - Key: " + key + " Error: " + error);
  45. };
  46. window.plugins.keychain.getForKey(key, servicename, win, fail);
  47. }
  48. function onSet()
  49. {
  50. var key = document.getElementById("keytoset").value;
  51. var value = document.getElementById("valuetoset").value;
  52. var servicename = document.getElementById("servicename").value;
  53. var win = function(key) {
  54. alert("SET SUCCESS - Key: " + key);
  55. };
  56. var fail = function(key, error) {
  57. alert("SET FAIL - Key: " + key + " Error: " + error);
  58. };
  59. window.plugins.keychain.setForKey(key, value, servicename, win, fail);
  60. }
  61. function onRemove()
  62. {
  63. var key = document.getElementById("keytoremove").value;
  64. var servicename = document.getElementById("servicename").value
  65. var win = function(key) {
  66. alert("REMOVE SUCCESS - Key: " + key);
  67. };
  68. var fail = function(key, error) {
  69. alert("REMOVE FAIL - Key: " + key + " Error: " + error);
  70. };
  71. window.plugins.keychain.removeForKey(key, servicename, win, fail);
  72. }
  73. </script>
  74. </head>
  75. <body onload="onBodyLoad()">
  76. <div style="color:red">(using servicename <input type="text" value="GOLDILOCKS" id="servicename" />)</div>
  77. <hr>
  78. <br />
  79. <div> GET FROM KEYCHAIN </div>
  80. <br />
  81. <label for="keytoget">Key to Get&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="keytoget" value="ILLUMINATI" /></label>
  82. <button onclick="onGet();">GET</button>
  83. <br />
  84. <hr />
  85. <br />
  86. <div> SET TO KEYCHAIN </div> <br />
  87. <label for="keytoset">Key to Set&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="keytoset" value="ILLUMINATI"/></label> <br />
  88. <label for="valuetoset">Value to Set <input type="text" id="valuetoset" value="SEKRIT" /></label>
  89. <button onclick="onSet();">SET</button>
  90. <br />
  91. <hr />
  92. <br />
  93. <div> REMOVE FROM KEYCHAIN </div> <br />
  94. <label for="keytoremove">Key to Remove<input type="text" id="keytoremove" value="ILLUMINATI"/></label>
  95. <button onclick="onRemove();">DEL</button>
  96. </body>
  97. </html>