define([ 'jquery', '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-listmap/chainpad-listmap.js', '/common/toolbar2.js', '/common/cryptpad-common.js', '/todo/todo.js', //'/common/media-tag.js', //'/bower_components/file-saver/FileSaver.min.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'less!/customize/src/less/cryptpad.less', ], function ($, Crypto, Listmap, Toolbar, Cryptpad, Todo) { var Messages = Cryptpad.Messages; var APP = window.APP = {}; $(function () { var $iframe = $('#pad-iframe').contents(); var $body = $iframe.find('body'); var ifrw = $('#pad-iframe')[0].contentWindow; var onReady = function () { var todo = Todo.init(APP.lm.proxy, Cryptpad); var deleteTask = function(id) { todo.remove(id); APP.display(); }; // TODO make this actually work, and scroll to bottom... var scrollTo = function (t) { var $list = $iframe.find('#tasksList'); $list.animate({ scrollTop: t, }); }; scrollTo = scrollTo; var display = APP.display = function () { var $list = $iframe.find('#tasksList'); $list.empty(); APP.lm.proxy.order.forEach(function(el) { var $taskDiv = $('
', { 'class': 'cp-task' }).appendTo($list); var entry = APP.lm.proxy.data[el]; var $check = $('', { type: 'checkbox', }) .on('change', function (e) { var checked = $check[0].checked; entry.state = checked? 1: 0; entry.mtime = +new Date(); }) .appendTo($taskDiv); $check[0].checked = entry.state? true: false; $('', { 'class': 'cp-task-text' }) .text(entry.task) .appendTo($taskDiv); $('', { 'class': 'cp-task-date' }) .text(new Date(entry.ctime).toLocaleString()) .appendTo($taskDiv); $('