nextcloud/apps/files_publiclink/js/admin.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
$( "#path" ).autocomplete({
source: "../../files/ajax/autocomplete.php",
minLength: 1
});
$(".delete").live('click', function( event ) {
event.preventDefault();
var token=$(this).attr('data-token');
var data="token="+token;
$.ajax({
type: 'GET',
url: 'ajax/deletelink.php',
cache: false,
data: data,
success: function(){
$('#'+token).remove();
}
});
});
2011-06-19 16:23:24 +04:00
$('#newlink').submit(function( event ){
event.preventDefault();
var path=$('#path').val();
var expire=0;
var data='path='+path+'&expire='+expire;
$.ajax({
type: 'GET',
url: 'ajax/makelink.php',
cache: false,
data: data,
success: function(token){
if(token){
var html="<tr class='link' id='"+token+"'>";
html+="<td class='path'>"+path+"</td>";
html+="<td class='link'><a href='get.php?token="+token+"'>"+$('#baseUrl').val()+"?token="+token+"</a></td>"
html+="<td><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
html+="</tr>"
$(html).insertBefore($('#newlink_row'));
$('#path').val('');
}
}
});
2011-06-07 23:48:21 +04:00
});
});