text: $(function(){var e="/admin_area/index.php";$(".oneNote .delete").on({click:function(e){e.preventDefault();var t=$(this).parent().attr("id");delete_note(t),$(this).parents("li").remove()}}),$("#add_new_note").on({click:function(t){t.preventDefault();var a=this,n=$(this).parents(".widgetBox").find("textarea").val();n?($(this).parents(".widgetBox").find("textarea").val(""),$.post(e,{mode:"add_note",note:n},function(e){var t=document.createElement("li");t.className="col-md-4";var d=document.createElement("a");d.className="delete",d.href="#",d.innerHTML="x";var o=document.createElement("p");o.id=e.id,o.innerHTML=$("<textarea/>").text(n).html(),o.className="oneNote",$(o).append(d),$(t).append(o),$(d).on({click:function(e){e.preventDefault();var t=$(this).parent().attr("id");delete_note(t),$(this).parents("li").remove()}}),$(a).parents(".widgetBox").find("ul").prepend(t)},"json")):alert("Please enter something")}}),$("#addTodo").on({click:function(t){t.preventDefault();var a=this,n=$(this).parents(".addTodo").find("input").val();n.length?($(this).parents(".addTodo").find("input").val(""),$.ajax({url:e,type:"post",data:{val:n,mode:"add_todo"}}).success(function(t){t=$.parseJSON(t);var n=document.createElement("li");n.className="col-md-12";var d=document.createElement("p");d.className="oneTodo paddingLeftSmall col-md-10",d.id=t.id,d.innerHTML=t.todo;var o=document.createElement("a");o.href="#",o.className="col-md-2 btn btn-danger btn-xs delete",o.innerHTML="{lang code='delete'}",$(o).on("click",function(t){t.preventDefault();var a=this,n=$(this).prev().attr("id");$.ajax({url:e,type:"post",data:{id:n,mode:"delete_todo"}}).success(function(e){$(a).parents("li").remove()})});var i=document.createElement("div");i.className="col-md-12",$(n).append(i).find("div").append(d).append(o),$(a).parents(".widgetBox").find("ul").prepend(n)})):alert("Please enter a valid value")}}),$("#todolist .delete").on("click",function(t){t.preventDefault();var a=this,n=$(this).prev().attr("id");$.ajax({url:e,type:"post",data:{id:n,mode:"delete_todo"}}).success(function(e){$(a).parents("li").remove()})}),$(".saveTodo").click(function(e){var t=this,a=$(this).parent().parent().find("input[name='todo']").val();a.length?$.ajax({url:"/admin_area/index.php",type:"post",data:{val:a,mode:"add_todo"}}).success(function(e){e=$.parseJSON(e);var a=document.createElement("p");a.className="xedit editable editable-click";var n=document.createElement("input");n.type="hidden",n.name="todoid",n.value=e.id;var d=document.createElement("b");d.innerHTML=e.todo,a.appendChild(n),a.appendChild(d),console.log(a),$(t).parents("form").after(a)}):alert("Please enter a valid value")}),$("#todolist").on("click",".editable-clear-x",function(e){e.preventDefault();var t=this,a=$(this).parents(".editable-container").prev().attr("id");a=(a=a.match(/([0-9]+)$/g)).pop(),$.ajax({url:"/admin_area/index.php",type:"post",data:{id:a,mode:"delete_todo"}}).success(function(e){$(t).parents("p").remove(),$(t).parents(".editable-container").remove()}),e.stopPropagation()})});