Debian Codegraph @

resources/main.js

raw symbols SCIP
1
2 /* Expanding menus for desktop layout */
3
4 $( function() {
5 // When the menus (or their respective little arrows, which are still
6 // contained in the menu element) are clicked, show their contents.
7 // CSS/LESS takes care of the users who don't have JS or have it disabled.
8 $( '#p-personal h3, #header-navigation .mw-portlet h3, #p-toolbox h3' ).on( 'click', function( e ) {
9 if ( $( window ).width() > 760 ) {
10 // Check if it's already open so we don't open it again
11 if ( $( this ).next( '.dropdown' ).is( ':visible' ) ) {
12 var wasOpen = true;
13 }
14 closeOpen(); // close all open ones, including this one
15 e.stopPropagation(); // stop hiding it!
16 if ( !wasOpen ) {
17 $( this ).next( '.dropdown' ).slideDown( 200 );
18 }
19 }
20 } );
21 $( document ).click( function( e ) {
22 if ( $( window ).width() > 760 ) {
23 if ( $( e.target ).closest( '#p-personal, #header-navigation .mw-portlet, #p-toolbox, #p-actions' ).length > 0 ) {
24 // Clicked inside an open menu; don't close anything
25 } else {
26 closeOpen();
27 }
28 }
29 } );
30 } );
31
32 function closeOpen( e ) {
33 // Close all dropdowns
34 $( '#p-personal, #header-navigation .mw-portlet, #p-toolbox, #p-actions' ).children( '.dropdown' ).each( function() {
35 if ( $( window ).width() > 760 ) {
36 if ( $( this ).is( ':visible' ) ) {
37 // .closest() doesn't work here like it does above...
38 $( this ).slideUp( 200 );
39 }
40 }
41 } );
42 };
43
44 /* Expanding menus (footer), p-actions */
45
46 $( function() {
47 $( '#footer-navigation h3, #p-actions h3' ).on( 'click', function() {
48 $( this ).next( 'div' ).slideToggle( 300 );
49 $( this ).parent().toggleClass( 'visible', 300, 'slide' );
50 } );
51
52 $( '#footer-navigation h3, #p-actions h3' ).next( 'div' ).hide();
53 } );