From 9eaf4673a9d5095031b1468923983f27326f9857 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 30 Jul 2018 15:01:23 +0900 Subject: [PATCH] Clean code --- app/db.sqlite3 | Bin 258048 -> 258048 bytes app/server/static/bundle/seq2seq.js | 2 +- app/server/static/js/seq2seq.js | 24 ------------------------ 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/app/db.sqlite3 b/app/db.sqlite3 index 9ec537cbd74fb66a240523a759d9fc24738aca65..de8eae68335bc93b6e3650606e571385c64db4c5 100644 GIT binary patch delta 669 zcmZXPPiWIn9LMvLH0jI8`?d4W(%P|j@E}{araDsxWz-$!LGU8tWu(=X+Tl{y+NnE8 zdntt-tn5%ct%s>NQKtceuu+CE5DLSAI22`AMV-2OQ4b25b_kUn-j@fT-96djG|@uU`s zjwN*MTr#dgk=l(KIF{1Vv2nlkBD(I`!35E?vrj_U(E4u7O9CuY@Ed->H+TncU=3EG z3LCI&IKy+m*%*Wv!Kl^)^KO-x6x87bjDtqLk`LrLc}kv;MPizsGP+Kh$GmDT-b2HP zQORbBpGRXf*);b0E|F5<58Y$BD`+E2Y>=T~$x6Eg8MtaCoq=O68^Q__jwUb4XCo6a z`EoKNpN_@!LEK>x?-og<<-`R!o=oWRL3@iMlG-vvn}j!)j?+V7E2c)lFZgbi{sc8E z<{5N01_`*S_NMX;WjU5Xn0-{Hzd##i8I0@=;mw~bv>28IZi<4p@DL{96gkp1BCy;` zZkC%eLXITo>JV5;K_BNT@9!3Cx%;);?OHBhUzlOc*+Wd&<*>mh1+QQM%8<9d`>Y}- z;e;FWmJ4J1_Qir^=PB<$*1B16^DVCbR|}n7X+~q*=9GD7{!Nu($;slafi?!~!D3A`z55Hy+hQeaJr@h6z&iEZVK9xvKrrpH& zOfuy@Nl(TCw`Zx;Y@tT*7r*fXUvPvy?4X8|;HtNdpmsJ;io|4v;0(KX3Rj-WukxeZ zmhWXn-F!#i$c2YjRArS8Qy!DQ{Du;p2|9b{r2pz4>r$;-^duKzs1j85_K^zrvMi!) z2DSRB7=4_~IQkOKvx&@XI+dAl`h;J7z*_meZbRuX_E632y1KhN0>onC&%NW|81C){(^{IoLQB66S$f4C3LJ zrYgp`cO%SDCisLh-eOK~-qJ(UFruP?^!rtpw}?K`Zupxnzt9w_?DG4w(y;RcKE~vR R{oT$7cb(_9${+IVwf}J9gyR4J diff --git a/app/server/static/bundle/seq2seq.js b/app/server/static/bundle/seq2seq.js index c1603a35..12986d35 100644 --- a/app/server/static/bundle/seq2seq.js +++ b/app/server/static/bundle/seq2seq.js @@ -185,7 +185,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _htt /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _mixin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixin.js */ \"./static/js/mixin.js\");\n/* harmony import */ var _http_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http.js */ \"./static/js/http.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(__webpack_require__(/*! vue-shortkey */ \"./node_modules/vue-shortkey/dist/index.js\"));\n\n\n\n// localStorage persistence\nvar STORAGE_KEY = 'todos-vuejs-2.0'\nvar todoStorage = {\n fetch: function () {\n var todos = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')\n todos.forEach(function (todo, index) {\n todo.id = index\n })\n todoStorage.uid = todos.length\n return todos\n },\n save: function (todos) {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(todos))\n }\n}\n\nvar vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n data: {\n todos: todoStorage.fetch(),\n newTodo: '',\n editedTodo: null\n },\n mixins: [_mixin_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]],\n directives: {\n 'todo-focus': function (el, binding) {\n if (binding.value) {\n el.focus()\n }\n }\n },\n methods: {\n addTodo: function () {\n var value = this.newTodo && this.newTodo.trim()\n if (!value) {\n return\n }\n\n var doc_id = this.items[this.cur].id;\n var payload = {text: value}\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post(`docs/${doc_id}/annotations/`, payload).then(response => {\n this.items[this.cur]['labels'].push(response.data)\n })\n\n this.newTodo = ''\n },\n\n removeTodo: function (todo) {\n var doc_id = this.items[this.cur].id;\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].delete(`docs/${doc_id}/annotations/${todo.id}`).then(response => {\n this.items[this.cur]['labels'].splice(this.items[this.cur]['labels'].indexOf(todo), 1)\n });\n },\n\n editTodo: function (todo) {\n this.beforeEditCache = todo.text\n this.editedTodo = todo\n },\n\n doneEdit: function (todo) {\n if (!this.editedTodo) {\n return\n }\n this.editedTodo = null\n todo.text = todo.text.trim()\n if (!todo.text) {\n this.removeTodo(todo)\n }\n var doc_id = this.items[this.cur].id;\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].put(`docs/${doc_id}/annotations/${todo.id}`, todo).then(response => {\n console.log(response)\n });\n },\n\n cancelEdit: function (todo) {\n this.editedTodo = null\n todo.text = this.beforeEditCache\n }\n },\n created: function () {\n this.updateProgress();\n this.submit();\n },\n watch: {\n todos: {\n handler: function (todos) {\n todoStorage.save(todos)\n },\n deep: true\n }\n }\n});\n\n//# sourceURL=webpack:///./static/js/seq2seq.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _mixin_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixin.js */ \"./static/js/mixin.js\");\n/* harmony import */ var _http_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http.js */ \"./static/js/http.js\");\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(__webpack_require__(/*! vue-shortkey */ \"./node_modules/vue-shortkey/dist/index.js\"));\n\n\n\n\nvar vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n data: {\n newTodo: '',\n editedTodo: null\n },\n mixins: [_mixin_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]],\n directives: {\n 'todo-focus': function (el, binding) {\n if (binding.value) {\n el.focus()\n }\n }\n },\n methods: {\n addTodo: function () {\n var value = this.newTodo && this.newTodo.trim()\n if (!value) {\n return\n }\n\n var doc_id = this.items[this.cur].id;\n var payload = {text: value}\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post(`docs/${doc_id}/annotations/`, payload).then(response => {\n this.items[this.cur]['labels'].push(response.data)\n })\n\n this.newTodo = ''\n },\n\n removeTodo: function (todo) {\n var doc_id = this.items[this.cur].id;\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].delete(`docs/${doc_id}/annotations/${todo.id}`).then(response => {\n this.items[this.cur]['labels'].splice(this.items[this.cur]['labels'].indexOf(todo), 1)\n });\n },\n\n editTodo: function (todo) {\n this.beforeEditCache = todo.text\n this.editedTodo = todo\n },\n\n doneEdit: function (todo) {\n if (!this.editedTodo) {\n return\n }\n this.editedTodo = null\n todo.text = todo.text.trim()\n if (!todo.text) {\n this.removeTodo(todo)\n }\n var doc_id = this.items[this.cur].id;\n _http_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].put(`docs/${doc_id}/annotations/${todo.id}`, todo).then(response => {\n console.log(response)\n });\n },\n\n cancelEdit: function (todo) {\n this.editedTodo = null\n todo.text = this.beforeEditCache\n }\n },\n created: function () {\n this.updateProgress();\n this.submit();\n }\n});\n\n//# sourceURL=webpack:///./static/js/seq2seq.js?"); /***/ }) diff --git a/app/server/static/js/seq2seq.js b/app/server/static/js/seq2seq.js index 2a2be174..fbdf2c83 100644 --- a/app/server/static/js/seq2seq.js +++ b/app/server/static/js/seq2seq.js @@ -3,27 +3,11 @@ Vue.use(require('vue-shortkey')); import annotationMixin from './mixin.js'; import HTTP from './http.js'; -// localStorage persistence -var STORAGE_KEY = 'todos-vuejs-2.0' -var todoStorage = { - fetch: function () { - var todos = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]') - todos.forEach(function (todo, index) { - todo.id = index - }) - todoStorage.uid = todos.length - return todos - }, - save: function (todos) { - localStorage.setItem(STORAGE_KEY, JSON.stringify(todos)) - } -} var vm = new Vue({ el: '#mail-app', delimiters: ['[[', ']]'], data: { - todos: todoStorage.fetch(), newTodo: '', editedTodo: null }, @@ -86,13 +70,5 @@ var vm = new Vue({ created: function () { this.updateProgress(); this.submit(); - }, - watch: { - todos: { - handler: function (todos) { - todoStorage.save(todos) - }, - deep: true - } } }); \ No newline at end of file