define([ '/customize/messages.js', '/customize/DecorateToolbar.js', '/customize/application_config.js', '/common/cryptpad-common.js', '/bower_components/lil-uri/uri.min.js', '/customize/email.js', '/bower_components/jquery/dist/jquery.min.js', ], function (Messages, DecorateToolbar, Config, Cryptpad, LilUri, Email) { var $ = window.$; var APP = window.APP = { Cryptpad: Cryptpad, }; var email = Email.makeScrambler(1); // slip past the spammers, then unscramble mailto links $('a[href^="mailto:"]').each(function () { $(this).attr('href', function (i, href) { return href.replace(/:(.*$)/, function (a, address) { return ':' + email.decrypt(address); }); }); }); DecorateToolbar.main($('#bottom-bar')); Cryptpad.styleAlerts(); var padTypes = { '/pad/': 'Pad', '/code/': 'Code', '/poll/': 'Poll', '/slide/': 'Presentation', }; var $table = $('table.scroll'); var $tbody = $table.find('tbody'); var $tryit = $('#tryit'); var now = new Date(); var hasRecent = false; var forgetPad = Cryptpad.forgetPad; var displayCreateButtons = function () { Config.availablePadTypes.forEach(function (el) { $('#create-' + el).show(); }); }; var makeRecentPadsTable = function (recentPads) { if (!recentPads.length) { return; } $('tbody tr').each(function (i, e) { if (!i) { return; } $(this).remove(); }); recentPads.some(function (pad, index) { if (!pad) { return; } hasRecent = true; // split up the uri var uri = LilUri(pad.href); // derive the name var name = padTypes[uri.path()]; var title = pad.title || uri.parts.hash.slice(0,8); var shortTitle = Cryptpad.truncate(pad.title, 48); var date = new Date(pad.atime).toLocaleDateString(); var created = new Date(pad.ctime).toLocaleDateString(); if (date === now.toLocaleDateString()) { date = new Date(pad.atime).toLocaleTimeString().replace(/ /g, ''); } var id = 'pad-'+index; var $row = $('