Issues (377)

modules/custom-sections/sections.js (49 issues)

1
jQuery( document ).ready( function() {
0 ignored issues
show
This file is missing a doc comment.
Loading history...
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
2
3
	wp.customize.section.each( function( section ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
4
5
		// Get the pane element.
6
		var pane      = jQuery( '#sub-accordion-section-' + section.id ),
7
			sectionLi = jQuery( '#accordion-section-' + section.id );
8
9
		// Check if the section is expanded.
10
		if ( sectionLi.hasClass( 'control-section-kirki-expanded' ) ) {
11
12
			// Move element.
13
			pane.appendTo( sectionLi );
14
15
		}
16
17
	} );
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...
18
19
} );
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...
20
21
/**
0 ignored issues
show
Missing short description in doc comment
Loading history...
22
 * @see https://wordpress.stackexchange.com/a/256103/17078
23
 */
24
( function() {
25
26
	var _panelEmbed,
27
		_panelIsContextuallyActive,
28
		_panelAttachEvents,
29
		_sectionEmbed,
30
		_sectionIsContextuallyActive,
31
		_sectionAttachEvents;
32
33
	wp.customize.bind( 'pane-contents-reflowed', function() {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
34
35
		var panels   = [],
36
			sections = [];
37
38
		// Reflow Sections.
39
		wp.customize.section.each( function( section ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
40
41
			if ( 'kirki-nested' !== section.params.type || _.isUndefined( section.params.section ) ) {
42
				return;
43
			}
44
			sections.push( section );
45
		} );
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...
46
47
		sections.sort( wp.customize.utils.prioritySort ).reverse();
48
49
		jQuery.each( sections, function( i, section ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
50
			var parentContainer = jQuery( '#sub-accordion-section-' + section.params.section );
51
52
			parentContainer.children( '.section-meta' ).after( section.headContainer );
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
55
		// Reflow Panels.
56
		wp.customize.panel.each( function( panel ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
57
			if ( 'kirki-nested' !== panel.params.type || _.isUndefined( panel.params.panel ) ) {
58
				return;
59
			}
60
			panels.push( panel );
61
		} );
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...
62
63
		panels.sort( wp.customize.utils.prioritySort ).reverse();
64
65
		jQuery.each( panels, function( i, panel ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
66
			var parentContainer = jQuery( '#sub-accordion-panel-' + panel.params.panel );
67
68
			parentContainer.children( '.panel-meta' ).after( panel.headContainer );
69
		} );
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...
70
	} );
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...
71
72
	// Extend Panel.
73
	_panelEmbed = wp.customize.Panel.prototype.embed;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 16 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
74
	_panelIsContextuallyActive = wp.customize.Panel.prototype.isContextuallyActive;
75
	_panelAttachEvents = wp.customize.Panel.prototype.attachEvents;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
76
77
	wp.customize.Panel = wp.customize.Panel.extend( {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
78
		attachEvents: function() {
79
			var panel;
80
81
			if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.panel ) ) {
82
				_panelAttachEvents.call( this );
83
				return;
84
			}
85
86
			_panelAttachEvents.call( this );
87
88
			panel = this;
89
90
			panel.expanded.bind( function( expanded ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
91
				var parent = wp.customize.panel( panel.params.panel );
92
93
				if ( expanded ) {
94
					parent.contentContainer.addClass( 'current-panel-parent' );
95
				} else {
96
					parent.contentContainer.removeClass( 'current-panel-parent' );
97
				}
98
			} );
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...
99
100
			panel.container.find( '.customize-panel-back' ).off( 'click keydown' ).on( 'click keydown', function( event ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
101
				if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
102
					return;
103
				}
104
				event.preventDefault(); // Keep this AFTER the key filter above
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
105
106
				if ( panel.expanded() ) {
107
					wp.customize.panel( panel.params.panel ).expand();
108
				}
109
			} );
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...
110
		},
111
112
		embed: function() {
113
114
			var panel = this,
115
				parentContainer;
116
			if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.panel ) ) {
117
				_panelEmbed.call( this );
118
				return;
119
			}
120
121
			_panelEmbed.call( this );
122
123
			parentContainer = jQuery( '#sub-accordion-panel-' + this.params.panel );
124
125
			parentContainer.append( panel.headContainer );
126
		},
127
128
		isContextuallyActive: function() {
129
130
			var panel = this,
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
131
				children,
132
				activeCount = 0;
133
134
			if ( 'kirki-nested' !== this.params.type ) {
135
				return _panelIsContextuallyActive.call( this );
136
			}
137
138
			children = this._children( 'panel', 'section' );
139
140
			wp.customize.panel.each( function( child ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
141
				if ( ! child.params.panel ) {
142
					return;
143
				}
144
145
				if ( child.params.panel !== panel.id ) {
146
					return;
147
				}
148
149
				children.push( child );
150
			} );
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...
151
152
			children.sort( wp.customize.utils.prioritySort );
153
154
			_( children ).each( function( child ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
155
				if ( child.active() && child.isContextuallyActive() ) {
156
					activeCount += 1;
157
				}
158
			} );
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...
159
			return ( 0 !== activeCount );
160
		}
161
	} );
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...
162
163
	// Extend Section.
164
	_sectionEmbed = wp.customize.Section.prototype.embed;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 16 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
165
	_sectionIsContextuallyActive = wp.customize.Section.prototype.isContextuallyActive;
166
	_sectionAttachEvents = wp.customize.Section.prototype.attachEvents;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
167
168
	wp.customize.Section = wp.customize.Section.extend( {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
169
		attachEvents: function() {
170
171
			var section = this;
172
173
			if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.section ) ) {
174
				_sectionAttachEvents.call( section );
175
				return;
176
			}
177
178
			_sectionAttachEvents.call( section );
179
180
			section.expanded.bind( function( expanded ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
181
				var parent = wp.customize.section( section.params.section );
182
183
				if ( expanded ) {
184
					parent.contentContainer.addClass( 'current-section-parent' );
185
				} else {
186
					parent.contentContainer.removeClass( 'current-section-parent' );
187
				}
188
			} );
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...
189
190
			section.container.find( '.customize-section-back' ).off( 'click keydown' ).on( 'click keydown', function( event ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
191
				if ( wp.customize.utils.isKeydownButNotEnterEvent( event ) ) {
192
					return;
193
				}
194
				event.preventDefault(); // Keep this AFTER the key filter above
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
195
				if ( section.expanded() ) {
196
					wp.customize.section( section.params.section ).expand();
197
				}
198
			} );
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...
199
		},
200
201
		embed: function() {
202
203
			var section = this,
204
				parentContainer;
205
206
			if ( 'kirki-nested' !== this.params.type || _.isUndefined( this.params.section ) ) {
207
				_sectionEmbed.call( section );
208
				return;
209
			}
210
211
			_sectionEmbed.call( section );
212
213
			parentContainer = jQuery( '#sub-accordion-section-' + this.params.section );
214
215
			parentContainer.append( section.headContainer );
216
		},
217
218
		isContextuallyActive: function() {
219
			var section = this,
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
220
				children,
221
				activeCount = 0;
222
			if ( 'kirki-nested' !== this.params.type ) {
223
				return _sectionIsContextuallyActive.call( this );
224
			}
225
226
			children = this._children( 'section', 'control' );
227
228
			wp.customize.section.each( function( child ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
229
				if ( ! child.params.section ) {
230
					return;
231
				}
232
233
				if ( child.params.section !== section.id ) {
234
					return;
235
				}
236
				children.push( child );
237
			} );
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...
238
239
			children.sort( wp.customize.utils.prioritySort );
240
241
			_( children ).each( function( child ) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
242
				if ( 'undefined' !== typeof child.isContextuallyActive ) {
243
					if ( child.active() && child.isContextuallyActive() ) {
244
						activeCount += 1;
245
					}
246
				} else {
247
					if ( child.active() ) {
248
						activeCount += 1;
249
					}
250
				}
251
			} );
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...
252
253
			return ( 0 !== activeCount );
254
		}
255
	} );
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...
256
}( jQuery ) );
257