X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/e0164e6ca0588a270b77d892702e54ef62c31de2..dbb6eb3883a5f5e371f4bf7c89e74326feca0fd1:/wolnelektury/static/js/catalogue.js?ds=sidebyside diff --git a/wolnelektury/static/js/catalogue.js b/wolnelektury/static/js/catalogue.js index e49f6b6a7..485780692 100644 --- a/wolnelektury/static/js/catalogue.js +++ b/wolnelektury/static/js/catalogue.js @@ -90,9 +90,20 @@ function changeBannerText() { } } -function autocomplete_result_handler(event, item) { - $(event.target).closest('form').submit(); +function autocomplete_format_item(ul, item) { + return $("
").data('item.autocomplete', item) + .append(''+item.label+ ' ('+item.category+')') + .appendTo(ul); } + +function autocomplete_result_handler(event, ui) { + if (ui.item.url != undefined) { + location.href = ui.item.url; + } else { + $(event.target).closest('form').submit(); + } +} + function serverTime() { var time = null; $.ajax({url: '/katalog/zegar/',