2011-08-24 22:16:44 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('#bookmark_add_submit').click(addBookmark);
|
2012-06-26 17:43:03 +02:00
|
|
|
$('#url-ro img').click(editUrl);
|
|
|
|
$('#url').keypress(changeUrl);
|
|
|
|
$('#addBm').submit(bookletSubmit);
|
|
|
|
$('#tags').tagit({
|
|
|
|
allowSpaces: true,
|
2012-06-27 00:09:55 +02:00
|
|
|
availableTags: sampleTags
|
2012-06-26 17:43:03 +02:00
|
|
|
});
|
2011-08-24 22:16:44 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
function addBookmark(event) {
|
|
|
|
var url = $('#bookmark_add_url').val();
|
|
|
|
var tags = $('#bookmark_add_tags').val();
|
|
|
|
$.ajax({
|
2012-06-10 23:38:26 +02:00
|
|
|
type: 'POST',
|
2011-08-24 22:16:44 +02:00
|
|
|
url: 'ajax/addBookmark.php',
|
2012-02-22 16:04:17 +01:00
|
|
|
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
2011-08-24 22:16:44 +02:00
|
|
|
success: function(data){
|
2012-02-21 23:08:57 +01:00
|
|
|
window.close();
|
2011-08-24 22:16:44 +02:00
|
|
|
}
|
|
|
|
});
|
2012-06-26 17:43:03 +02:00
|
|
|
}
|
|
|
|
function editUrl(event) {
|
|
|
|
$('#url').slideToggle();
|
|
|
|
}
|
|
|
|
function changeUrl(event) {
|
|
|
|
$('#url-ro code').text($('#url').val());
|
|
|
|
}
|
|
|
|
function bookletSubmit(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
$.ajax({
|
|
|
|
type: 'POST',
|
|
|
|
url: $('#addBm').attr('action'),
|
|
|
|
data: $('#addBm').serialize(),
|
|
|
|
success: function(data){
|
2012-06-27 00:09:55 +02:00
|
|
|
if(data.status == 'success'){
|
|
|
|
self.close();
|
|
|
|
}
|
2012-06-26 17:43:03 +02:00
|
|
|
}
|
|
|
|
});
|
2011-08-24 22:16:44 +02:00
|
|
|
}
|