X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/29a13b9e77d5a7ac5d26c95488028f88e6b57c2f..a1edf3f1a7cff6e6f4d85a4288ca9b1d5cd3b254:/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 index 4d979af0c..4b6c5d34e 100755 --- a/apps/wolnelektury_core/static/js/base.js +++ b/apps/wolnelektury_core/static/js/base.js @@ -77,7 +77,23 @@ dataType: "json", }).done(function(data) { $.each(data, function(index, value) { - $('#menu-' + index).html(value); + var $menuitem = $('#menu-' + index); + $menuitem.html(value); + var $minisearch = $(""); + $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(); } @@ -103,6 +120,14 @@ })(); +$('#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) {