X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1e9113af163a3d002b0b9c3e8c339f22af5b848a..0bd2f26c7d4a349bf9ae9377a945baf39d28af00:/apps/wolnelektury_core/static/js/base.js

diff --git a/apps/wolnelektury_core/static/js/base.js b/apps/wolnelektury_core/static/js/base.js
old mode 100755
new mode 100644
index 9ba5631fa..f2a8e262a
--- a/apps/wolnelektury_core/static/js/base.js
+++ b/apps/wolnelektury_core/static/js/base.js
@@ -73,11 +73,27 @@
 						$current = $hidden;
                         if ($(this).hasClass('load-menu') && !menu_loaded) {
                             $.ajax({
-                                url: '/katalog/',
+                                url: '/katalog/' + LANGUAGE_CODE + '.json',
                                 dataType: "json",
                             }).done(function(data) {
                                 $.each(data, function(index, value) {
-                                    $('#menu-' + index).html(value);
+                                    var $menuitem = $('#menu-' + index);
+                                    $menuitem.html(value);
+                                    var $minisearch = $("<input class='mini-search' style='margin-bottom: 1em' />");
+                                    $minisearch.keyup(function() {
+                                        var s = $(this).val().toLowerCase();
+                                        if (s) {
+                                            $("li", $menuitem).each(function() {
+                                                if ($("a", this).text().toLowerCase().indexOf(s) != -1)
+                                                    $(this).show();
+                                                else $(this).hide();
+                                            });
+                                        }
+                                        else {
+                                            $("li", $menuitem).css("display", "");
+                                        }
+                                    });
+                                    $menuitem.prepend($minisearch);
                                 });
                                 menu_loaded = true;
                             });
@@ -93,7 +109,8 @@
 					if (p == $current)
 						return;
 					if (p.hasClass('hidden-box-trigger') 
-					    || p.hasClass('simple-toggler'))
+					    || p.hasClass('simple-toggler')
+                        || p.hasClass('mini-search'))
 						return;
 					p = p.parent();
 				}