keep people from derping themselves

localStorage XSS? yup. that happened
pull/1/head
ansuz 9 years ago
parent 750731d3db
commit 789bc3ecc1

@ -6,6 +6,7 @@ define([
], function (DecorateToolbar, Cryptpad, LilUri) { ], function (DecorateToolbar, Cryptpad, LilUri) {
var $ = window.$; var $ = window.$;
DecorateToolbar.main($('#bottom-bar')); DecorateToolbar.main($('#bottom-bar'));
Cryptpad.styleAlerts();
var $table = $('table.scroll'); var $table = $('table.scroll');
var $tbody = $table.find('tbody'); var $tbody = $table.find('tbody');
@ -62,27 +63,37 @@ define([
var id = 'pad-'+index; var id = 'pad-'+index;
$tbody.append('<tr id="'+id+'">' + var $row = $('<tr>', {
'<td>' + name + '</td>' + id: id
//'<td>' + title + '</td>' + });
'<td><a href="' + pad.href + '" title="'+ pad.title + '">' + shortTitle + '</a></td>' +
'<td>' + created + '</td>' + // created var $remove = $('<td>', {
'<td>' + date + '</td>' + 'class': 'remove',
'<td class="remove" title="forget \''+shortTitle+'\'">✖</td>'+ title: "forget '"+shortTitle + "'"
'</tr>'); }).text('✖').click(function () {
Cryptpad.confirm("Are you sure you'd like to forget this pad (" + shortTitle + ")?", function (yes) {
var $row = $('#'+id); if (!yes) { return; }
$row.find('.remove').click(function () { forgetPad(pad.href);
if (!window.confirm("Are you sure you'd like to forget this pad (" + shortTitle + ")?")) { return; } $row.fadeOut(750, function () {
forgetPad(pad.href); $row.remove();
$row.fadeOut(750, function () { if (!$table.find('tr').find('td').length) {
$row.remove(); $table.remove();
if (!$table.find('tr').find('td').length) { $tryit.text("Try it out!");
$table.remove(); }
$tryit.text("Try it out!"); });
}
}); });
}); });
$row
.append($('<td>').text(name))
.append($('<td>').append($('<a>', {
href: pad.href,
title: pad.title,
}).text(shortTitle)))
.append($('<td>').text(created))
.append($('<td>').text(date))
.append($remove);
$tbody.append($row);
}); });
}; };

Loading…
Cancel
Save