1/** 2 * @file 3 * Custom scripts for theme. 4 */ 5(function ($) { 6 7 function openSubmenu(e, targetSelector){ 8 if ($('body').hasClass('has-dropdown')) { 9 // Find out if this menu was open. 10 var open = false; 11 if ($(targetSelector).hasClass("open")) { 12 var open = true; 13 } 14 // Close all open mega menus and remove open class. 15 $('.chinafile-submenu.open').slideToggle(200); 16 $('.chinafile-submenu.open').removeClass("open"); 17 // If it wasn't open, open it! 18 if (!open) { 19 $(targetSelector).slideToggle(200); 20 $(targetSelector).addClass("open"); 21 } 22 // Prevent link click. 23 e.preventDefault(); 24 } 25 } 26 27 $(document).ready(function() { 28 29 // Hide all the sub-menus. 30 $('.chinafile-submenu').hide(); 31 32 // When reporting link is clicked... 33 $('li.menu-link-reporting--opinion a').click(function(e){ 34 // Open the submenu. 35 openSubmenu(e, '.chinafile-menu-reporting'); 36 }); 37 38 // When library link is clicked... 39 $('li.menu-link-library a').click(function(e){ 40 // Open the submenu. 41 openSubmenu(e, '.chinafile-menu-library'); 42 }); 43 44 // When multimedia link is clicked... 45 $('li.menu-link-multimedia a').click(function(e){ 46 // Open the submenu. 47 openSubmenu(e, '.chinafile-menu-multimedia'); 48 }); 49 50 // When topics link is clicked... 51 $('li.menu-link-topics a').click(function(e){ 52 // Open the submenu. 53 openSubmenu(e, '.chinafile-menu-topics'); 54 }); 55 56 // When contributors link is clicked... 57 $('li.menu-link-contributors a').click(function(e){ 58 // Open the submenu. 59 openSubmenu(e, '.chinafile-menu-contributors'); 60 }); 61 62 }); 63 64})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.