1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-11-30 05:24:09 +01:00

autoretrieve title and description after entering new url

This commit is contained in:
Arthur Schiwon 2011-08-23 16:30:29 +02:00
parent 001533bf81
commit 6d7dd830e9

View File

@ -9,6 +9,8 @@ $(document).ready(function() {
$('#bookmark_add_submit').click(addBookmark); $('#bookmark_add_submit').click(addBookmark);
$(window).scroll(updateOnBottom); $(window).scroll(updateOnBottom);
$('#bookmark_add_url').focusout(getMetadata);
$('.bookmarks_list').empty(); $('.bookmarks_list').empty();
getBookmarks(); getBookmarks();
}); });
@ -36,6 +38,18 @@ function getBookmarks() {
}); });
} }
function getMetadata() {
var url = encodeEntities($('#bookmark_add_url').val())
$.ajax({
url: 'ajax/getMeta.php',
data: 'url=' + encodeURI(url),
success: function(pageinfo){
$('#bookmark_add_description').val(pageinfo.data.description);
$('#bookmark_add_title').val(pageinfo.data.title);
}
});
}
function addBookmark(event) { function addBookmark(event) {
var url = encodeEntities($('#bookmark_add_url').val()) var url = encodeEntities($('#bookmark_add_url').val())
var title = encodeEntities($('#bookmark_add_title').val()) var title = encodeEntities($('#bookmark_add_title').val())