librarian bump
[wolnelektury.git] / apps / wolnelektury_core / static / js / widgetInit.js
index ab57a30..4cfa85a 100644 (file)
@@ -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/",
                        source: function(request, response) {
                                $.ajax({
                                        url: "http://www.wolnelektury.pl/katalog/jtags/",
@@ -27,3 +42,4 @@
             }                  
                });
        });
             }                  
                });
        });
+*/