index.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <meta name="viewport" id="iphone-viewport" content="minimum-scale=1.0, maximum-scale=1.0, width=device-width" />
  5. <meta name="apple-mobile-web-app-capable" content="yes" />
  6. <link rel="stylesheet" href="spinningwheel.css" type="text/css" media="all" />
  7. <script type="text/javascript" src="spinningwheel-min.js?v=1.4"></script>
  8. <title>Spinning Wheel for iPhone/iPod touch</title>
  9. <script type="text/javascript">
  10. function openWeight() {
  11. var numbers = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9 };
  12. SpinningWheel.addSlot(numbers, 'right');
  13. SpinningWheel.addSlot(numbers, 'right');
  14. SpinningWheel.addSlot(numbers, 'right');
  15. SpinningWheel.addSlot({ separator: '.' }, 'readonly shrink');
  16. SpinningWheel.addSlot(numbers, 'right');
  17. SpinningWheel.addSlot({ Kg: 'Kg', Lb: 'Lb', St: 'St' }, 'shrink');
  18. SpinningWheel.setCancelAction(cancel);
  19. SpinningWheel.setDoneAction(done);
  20. SpinningWheel.open();
  21. }
  22. function openBirthDate() {
  23. var now = new Date();
  24. var days = { };
  25. var years = { };
  26. var months = { 1: 'Gen', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec' };
  27. for( var i = 1; i < 32; i += 1 ) {
  28. days[i] = i;
  29. }
  30. for( i = now.getFullYear()-100; i < now.getFullYear()+1; i += 1 ) {
  31. years[i] = i;
  32. }
  33. SpinningWheel.addSlot(years, 'right', 1999);
  34. SpinningWheel.addSlot(months, '', 4);
  35. SpinningWheel.addSlot(days, 'right', 12);
  36. SpinningWheel.setCancelAction(cancel);
  37. SpinningWheel.setDoneAction(done);
  38. SpinningWheel.open();
  39. }
  40. function openOneSlot() {
  41. SpinningWheel.addSlot({1: 'Ichi', 2: 'Ni', 3: 'San', 4: 'Shi', 5: 'Go'});
  42. SpinningWheel.setCancelAction(cancel);
  43. SpinningWheel.setDoneAction(done);
  44. SpinningWheel.open();
  45. }
  46. function done() {
  47. var results = SpinningWheel.getSelectedValues();
  48. document.getElementById('result').innerHTML = 'values: ' + results.values.join(' ') + '<br />keys: ' + results.keys.join(', ');
  49. }
  50. function cancel() {
  51. document.getElementById('result').innerHTML = 'cancelled!';
  52. }
  53. window.addEventListener('load', function(){ setTimeout(function(){ window.scrollTo(0,0); }, 100); }, true);
  54. </script>
  55. <style type="text/css">
  56. body { text-align:center; font-family:helvetica; }
  57. button { font-size:16px; }
  58. #result { margin:10px; background:#aaa; -webkit-border-radius:8px; padding:8px; font-size:18px; }
  59. </style>
  60. </head>
  61. <body>
  62. <p>Spinning Wheel slot machine alike widget for iPhone and iPod touch.
  63. This demo works only on the simulator and the real devices, it does not work on any other browser.</p>
  64. <button onclick="openBirthDate()">birth date</button>
  65. <button onclick="openWeight()">weight</button>
  66. <button onclick="openOneSlot()">1 slot</button>
  67. <p id="result">results</p>
  68. <p><a href="http://cubiq.org/spinning-wheel-on-webkit-for-iphone-ipod-touch/11">Read the related article on cubiq.org</a></p>
  69. <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  70. <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
  71. this text is here for the sole purpose of making the page longer
  72. </body>
  73. </html>