X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6280673f35e13e75e81c5b7821bd2a44a1831eab..357027375ff8867f42ca34bcbfb5a78b5b185fc3:/src/wolnelektury/static/js/widget_run.js diff --git a/src/wolnelektury/static/js/widget_run.js b/src/wolnelektury/static/js/widget_run.js new file mode 100644 index 000000000..c2453e722 --- /dev/null +++ b/src/wolnelektury/static/js/widget_run.js @@ -0,0 +1,26 @@ +var s = $('#id_qq'); +var url = s.attr('data-source'); +s.search({ + source: function(req, cb) { + $.ajax({url: url, + dataType: "jsonp", + data: {term: req.term}, + type: "GET", + success: function(data) {cb(data);}, + error: function() {cb([]);} + }); + }, + dataType: "jsonp", + select: function(event, ui) { + if (ui.item.url != undefined) { + window.top.location.href = '//wolnelektury.pl' + ui.item.url; + } else { + $('form').submit(); + } + }, + position: { + my: "center bottom", + at: "center bottom", + of: "#wl a" + }, +});