index.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <!doctype html>
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <meta charset="utf-8" />
  5. </head>
  6. <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.red-blue.min.css" />
  7. <!-- <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script> -->
  8. <style>
  9. .addinput {
  10. border: 0px;
  11. border-top: 1px solid #aaa;
  12. height: 80px;
  13. width: 100%;
  14. }
  15. .addbutton {
  16. float: right;
  17. border: 1px solid #aaa;
  18. height: 80px;
  19. width: 19%;
  20. }
  21. .entry {
  22. position: fixed;
  23. bottom: 0;
  24. width: 100%;
  25. display: inline;
  26. height: 80px;
  27. }
  28. .item-todo {
  29. font-weight: 800;
  30. font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
  31. line-height: 5em;
  32. height: 5em;
  33. }
  34. .item-font {
  35. font-size: 3em;
  36. padding: 1em;
  37. }
  38. .deleter {
  39. text-transform: lowercase;
  40. font-family: Arial, Helvetica, sans-serif;
  41. width: 100px;
  42. height: 5em;
  43. float: right;
  44. text-decoration: none;
  45. cursor: pointer;
  46. }
  47. .deleter:after {
  48. display: inline-block;
  49. font-size: 4em;
  50. content: "\00d7";
  51. position: relative;
  52. padding-left: 0.5em;
  53. }
  54. .inputholder {
  55. display: block;
  56. overflow: hidden;
  57. }
  58. @media (max-width: 600px) {
  59. .item-todo {
  60. font-size: 1em;
  61. height: 3em;
  62. line-height: 3em;
  63. }
  64. .item-font {
  65. font-size: 1em;
  66. padding: 1em;
  67. }
  68. .deleter {
  69. height: 3em;
  70. }
  71. .deleter:after {
  72. font-size: 2em;
  73. padding-left: 2em;
  74. }
  75. .addinput,
  76. .addbutton,
  77. .entry {
  78. height: 40px;
  79. }
  80. }
  81. </style>
  82. <!-- HTML PART ###################################################################################################################################-->
  83. <div id="app">
  84. <div class="item-todo" v-for="task in config.tasks">
  85. <span class="item-font">
  86. {{task}}
  87. </span>
  88. <span class="deleter" href="#" @click="remove(task)"></span>
  89. </div>
  90. <div class="entry">
  91. <button class="addbutton" onclick="app.save">add</button>
  92. <span class="inputholder">
  93. <input class="addinput" v-model="task_input" v-on:keyup.enter="save">
  94. </span>
  95. </div>
  96. <!-- <button onclick="adapter.setter()">save</button>
  97. <button onclick="adapter.getter()">load</button> -->
  98. </div>
  99. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  100. <script src="static/adapter.js"></script>
  101. <script>
  102. var app = new Vue({
  103. el: '#app',
  104. data: {
  105. task_input: "",
  106. config: {
  107. tasks: []
  108. },
  109. },
  110. mounted: function () {
  111. adapter.onget = function () {
  112. app.config = adapter.responseJson
  113. }
  114. adapter.onset = function () {
  115. return app.config;
  116. }
  117. adapter.getter();
  118. setInterval(function () {
  119. adapter.getter();
  120. }, 600000);
  121. },
  122. watch: {},
  123. computed: {
  124. save: function () {
  125. this.config.tasks.push(this.task_input);
  126. this.task_input = "";
  127. adapter.setter();
  128. },
  129. },
  130. methods: {
  131. remove: function (item) {
  132. console.log(item);
  133. this.config.tasks.splice(this.config.tasks.indexOf(item), 1);
  134. adapter.setter();
  135. },
  136. }
  137. })
  138. </script>
  139. <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">