X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6e32f55e3ef50d9f7d3a291c2388c5220851a9b4..4fb0bfd1b7351af7d83a2cc69e7fca666a359160:/apps/wolnelektury_core/static/js/widgetInit.js diff --git a/apps/wolnelektury_core/static/js/widgetInit.js b/apps/wolnelektury_core/static/js/widgetInit.js index ab57a3062..4cfa85a26 100644 --- a/apps/wolnelektury_core/static/js/widgetInit.js +++ b/apps/wolnelektury_core/static/js/widgetInit.js @@ -1,5 +1,20 @@ - $(function() { - $("#id_qq").autocomplete({ + +var wl_scripts_loaded = {}; + +function wl_load_search_if_ready(id) { + wl_scripts_loaded[id] = true; + if (wl_scripts_loaded['wl-search-script'] && + wl_scripts_loaded['wl-jquery-ui-script']) + { + var s = $('#id_qq'); + s.search({source: s.attr('data-source')}); + } +} + +$('#wl-search-script').ready(function(){wl_load_search_if_ready('wl-search-script');}); +$('#wl-jquery-ui-script').ready(function(){wl_load_search_if_ready('wl-jquery-ui-script');}); + +/*autocomplete({ source: function(request, response) { $.ajax({ url: "http://www.wolnelektury.pl/katalog/jtags/", @@ -27,3 +42,4 @@ } }); }); +*/