Fix: Uglier but supported by Chrome
[wolnelektury.git] / apps / wolnelektury_core / static / js / base.js
old mode 100755 (executable)
new mode 100644 (file)
index 4d979af..4b6c5d3
                                 dataType: "json",
                             }).done(function(data) {
                                 $.each(data, function(index, value) {
                                 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;
                             });
                                 });
                                 menu_loaded = true;
                             });
                                        if (p == $current)
                                                return;
                                        if (p.hasClass('hidden-box-trigger') 
                                        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();
                                }
                                                return;
                                        p = p.parent();
                                }
                })();
                
 
                })();
                
 
+$('#show-menu').click(function(event) {
+    event.preventDefault();
+    $('#menu').toggle('slow');
+});
+$('#book-list-nav h2').click(function(event) {
+    event.preventDefault();
+    $('#book-list-nav-index').toggle();
+});
 
 
 $('#themes-list-toggle').click(function(event) {
 
 
 $('#themes-list-toggle').click(function(event) {