1 | /* global kirkiTooltips */ |
||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
2 | jQuery( document ).ready( function() { |
||
0 ignored issues
–
show
|
|||
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 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
29 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
30 | |||
31 | // Close tooltips if we click anywhere else. |
||
32 | jQuery( document ).mouseup( function( e ) { |
||
0 ignored issues
–
show
|
|||
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 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
40 | } |
||
41 | |||
42 | wp.customize.control.each( function( control ) { |
||
0 ignored issues
–
show
|
|||
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 ) { |
||
0 ignored issues
–
show
|
|||
48 | if ( expanded ) { |
||
49 | kirkiTooltipAdd( control ); |
||
50 | } |
||
51 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
52 | } |
||
53 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
54 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
55 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
56 |