macrofish

piciwtfJS

Mar 12th, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. $(document).on("pagecreate", "#page1", function()
  8. {
  9.  
  10. $('#mydate').bind('change', function() {
  11. var mytime = $('#mydate').datebox('getTheDate');
  12. });
  13.  
  14. });
  15.  
  16. $(document).on("pagecreate", "#page1", function(event)
  17. {
  18. showTodo();
  19. });
  20. function Item(name, note, date, value, vibration, volume)
  21. {
  22. this.name = name;
  23. this.note = note;
  24. this.date = date;
  25. this.value = value;
  26. this.vibration = vibration;
  27. this.volume = volume;
  28.  
  29. }
  30.  
  31. function saveTodo()
  32. {
  33. var indx = localStorage.length;
  34. var todoText = $("#taskName").val();
  35.  
  36.  
  37.  
  38.  
  39.  
  40. var newItem = new Item(todoText, "gr", "rg", "wd", "ad", "wd");
  41.  
  42. var stringObject = JSON.stringify(newItem);
  43.  
  44. if (todoText.length)
  45. {
  46. localStorage.setItem('task_' + indx, stringObject);//['task_' + indx] = stringObject;
  47. //localStorage.setItem('task_'+indx,todoText);
  48. indx++;
  49. }
  50.  
  51. showTodo();
  52. }
  53.  
  54.  
  55.  
  56.  
  57. /*
  58. <div data-role="collapsible" id="set1" data-collapsed="true">
  59. <h3>Section 1</h3>
  60. <p>I'm the collapsible content.</p>
  61. </div>
  62. */
  63.  
  64.  
  65. function clearTodo()
  66. {
  67. localStorage.clear();
  68. indx = localStorage.length;
  69. $("#todoList").empty();
  70.  
  71. }
  72.  
  73. function showTodo()
  74. {
  75.  
  76.  
  77. //$('.list').collapsible({refresh: true});
  78.  
  79. var todoText;
  80. var content = "pico";
  81. $("#todoList").empty();
  82. for (var i = 0; i < localStorage.length; i++)
  83. {
  84. todoText = localStorage.getItem('task_' + i);
  85. var item = JSON.parse(todoText);
  86. $("#todoList").append("<div data-role=\"collapsible\" id=\"set1\" data-collapsed=\"true\" class='items'>" + "<h3>" + item.name + "</h3>" +
  87. "<p>" + content + "</p></div>");
  88.  
  89. }
  90.  
  91.  
  92.  
  93. $('.items').collapsible({refresh: true});
  94.  
  95.  
  96. }
Advertisement
Add Comment
Please, Sign In to add comment