Passed
Push — develop ( fe986b...95ca01 )
by Aristeides
04:19
created

modules/icons/icons.js   A

Complexity

Total Complexity 5
Complexity/F 1.67

Size

Lines of Code 29
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 0
wmc 5
c 1
b 1
f 0
nc 1
mnd 1
bc 5
fnc 3
dl 0
loc 29
rs 10
bpm 1.6666
cpm 1.6666
noi 0
1
/* global kirkiIcons */
2
jQuery( document ).ready( function() {
3
4
	'use strict';
5
6
	if ( ! _.isUndefined( kirkiIcons.section ) ) {
7
8
		// Parse sections and add icons.
9
		_.each( kirkiIcons.section, function( icon, sectionID ) {
10
11
			// Add icons in list.
12
			jQuery( '#accordion-section-' + sectionID + ' > h3' ).addClass( 'dashicons-before ' + icon );
13
14
			// Add icons on titles when a section is open.
15
			jQuery( '#sub-accordion-section-' + sectionID + ' .customize-section-title > h3' ).append( '<span class="dashicons ' + icon + '" style="float:left;padding-right:.1em;padding-top:2px;"></span>' );
16
		} );
17
18
	}
19
20
	if ( ! _.isUndefined( kirkiIcons.panel ) ) {
21
22
		_.each( kirkiIcons.panel, function( icon, panelID ) {
23
24
			// Add icons in lists & headers.
25
			jQuery( '#accordion-panel-' + panelID + ' > h3, #sub-accordion-panel-' + panelID + ' .panel-title' ).addClass( 'dashicons-before ' + icon );
26
		} );
27
28
	}
29
30
} );
31