2011-06-02 04:45:35 +04:00
|
|
|
$(document).ready(function() {
|
|
|
|
$( "#path" ).autocomplete({
|
|
|
|
source: "../../files/ajax/autocomplete.php",
|
|
|
|
minLength: 1
|
|
|
|
});
|
2011-08-08 13:17:03 +04:00
|
|
|
$(".delete").live('click', function( event ) {
|
2011-06-02 04:45:35 +04:00
|
|
|
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 ){
|
2011-06-02 04:45:35 +04:00
|
|
|
event.preventDefault();
|
|
|
|
var path=$('#path').val();
|
2011-08-08 13:17:03 +04:00
|
|
|
var expire=0;
|
2011-06-02 04:45:35 +04:00
|
|
|
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>";
|
2011-08-11 13:10:34 +04:00
|
|
|
html+="<td class='link'><input type='text' value='"+$('#baseUrl').val()+"?token="+token+"' /></td>"
|
2011-08-08 13:17:03 +04:00
|
|
|
html+="<td><input type='submit' class='delete' data-token='"+token+" value='Delete' /></td>"
|
2011-06-02 04:45:35 +04:00
|
|
|
html+="</tr>"
|
2011-08-08 15:19:22 +04:00
|
|
|
$(html).insertAfter($('#newlink_row'));
|
2011-06-02 04:45:35 +04:00
|
|
|
$('#path').val('');
|
2011-08-11 13:10:34 +04:00
|
|
|
$('#'+token+' input').focus();
|
|
|
|
$('#'+token+' input').select();
|
2011-06-02 04:45:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2011-06-07 23:48:21 +04:00
|
|
|
});
|
2011-08-08 13:17:03 +04:00
|
|
|
});
|