Commit 55b0a366 authored by Luc Didry's avatar Luc Didry

Fixes #23

This commit is dedicated to Schoumi, who is supporting me on Tipeee. Many thanks :-)
parent 834f2520
......@@ -10,6 +10,7 @@ Revision history for Lufi
- Portuguese translation
- Catalan translation
- IE 11 support
- Deleting files from "My files" is now done with Ajax (#23)
- Bugfixes
0.01 2017-01-09
......
......@@ -106,6 +106,30 @@ function importStorage(f) {
reader.readAsArrayBuffer(f[0]);
}
function delFile() {
var dlink = $(this).attr('data-dlink');
var short = $(this).attr('data-short');
$.ajax({
url: dlink,
method: 'GET',
data: {
format: 'json'
},
success: function(data) {
if (data.success) {
$('#row-'+short).remove();
delItem(short);
} else {
alert(data.msg);
}
},
error: function() {
},
complete: function() {
}
});
}
function populateFilesTable() {
$('#myfiles').empty();
......@@ -125,7 +149,7 @@ function populateFilesTable() {
var limit = (element.delay === 0) ? i18n.noExpiration : moment.unix(element.delay * 86400 + element.created_at).locale(window.navigator.language).format('LLLL');
var created_at = moment.unix(element.created_at).locale(window.navigator.language).format('LLLL');
var tr = $('<tr>');
var tr = $('<tr id="row-'+element.short+'">');
tr.html([ '<td class="left-align">',
escapeHtml(element.name),
'</td>',
......@@ -144,12 +168,13 @@ function populateFilesTable() {
limit,
'</td>',
'<td class="center-align">',
'<a href="', dlink, '" class="classic"><i class="small mdi-action-delete"></i></a>',
'<a id="del-', element.short, '" data-short="', element.short, '" data-dlink="', dlink, '" href="#" class="classic"><i class="small mdi-action-delete"></i></a>',
'</td>',
'<td class="center-align">',
'<a href="'+baseURL+'m?links=[&quot;'+element.short+'&quot;]" class="classic"><i class="small mdi-communication-email"></i></a>',
'</td>'].join(''));
$('#myfiles').append(tr);
$('#del-'+element.short).on('click', delFile);
$.ajax({
url: counterURL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment