arguments for multi-line function calls are on separate lines.
1 | /* global kirkiTooltips */ |
||
2 | jQuery( document ).ready( function() { |
||
3 | |||
4 | function kirkiTooltipAdd( control ) { |
||
5 | _.each( kirkiTooltips, function( tooltip ) { |
||
0 ignored issues
–
show
|
|||
6 | let trigger, |
||
7 | controlID, |
||
8 | content; |
||
9 | |||
10 | if ( tooltip.id !== control.id ) { |
||
11 | return; |
||
12 | } |
||
13 | |||
14 | if ( control.container.find( '.tooltip-content' ).length ) { |
||
15 | return; |
||
16 | } |
||
17 | |||
18 | trigger = '<span class="tooltip-trigger" data-setting="' + tooltip.id + '"><span class="dashicons dashicons-editor-help"></span></span>'; |
||
19 | controlID = '#customize-control-' + tooltip.id; |
||
20 | content = '<div class="tooltip-content hidden" data-setting="' + tooltip.id + '">' + tooltip.content + '</div>'; |
||
21 | |||
22 | // Add the trigger & content. |
||
23 | jQuery( '<div class="tooltip-wrapper">' + trigger + content + '</div>' ).prependTo( controlID ); |
||
24 | |||
25 | // Handle onclick events. |
||
26 | jQuery( '.tooltip-trigger[data-setting="' + tooltip.id + '"]' ).on( 'click', function() { |
||
0 ignored issues
–
show
|
|||
27 | jQuery( '.tooltip-content[data-setting="' + tooltip.id + '"]' ).toggleClass( 'hidden' ); |
||
28 | } ); |
||
29 | } ); |
||
30 | |||
31 | // Close tooltips if we click anywhere else. |
||
32 | jQuery( document ).mouseup( function( e ) { |
||
33 | |||
34 | if ( ! jQuery( '.tooltip-content' ).is( e.target ) ) { |
||
35 | if ( ! jQuery( '.tooltip-content' ).hasClass( 'hidden' ) ) { |
||
36 | jQuery( '.tooltip-content' ).addClass( 'hidden' ); |
||
37 | } |
||
38 | } |
||
39 | } ); |
||
40 | } |
||
41 | |||
42 | wp.customize.control.each( function( control ) { |
||
43 | wp.customize.section( control.section(), function( section ) { |
||
0 ignored issues
–
show
|
|||
44 | if ( section.expanded() || wp.customize.settings.autofocus.control === control.id ) { |
||
45 | kirkiTooltipAdd( control ); |
||
46 | } else { |
||
47 | section.expanded.bind( function( expanded ) { |
||
48 | if ( expanded ) { |
||
49 | kirkiTooltipAdd( control ); |
||
50 | } |
||
51 | } ); |
||
52 | } |
||
53 | } ); |
||
54 | } ); |
||
55 | } ); |
||
56 |
For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this: