Completed
Push — master ( f2c63f...720388 )
by Donata
02:09
created

src/javascript/blocks/maps/functions/createNavigationButton.js   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 20
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
wmc 1
nc 1
mnd 0
bc 1
fnc 1
dl 0
loc 20
rs 10
bpm 1
cpm 1
noi 0
c 0
b 0
f 0
1
/**
2
 * @param image
3
 * @param container
4
 * @returns {Element}
5
 */
6
export function createNavigationButton(image, container) {
7
    let control = container.querySelector('.gmnoprint.gm-bundled-control.gm-bundled-control-on-bottom > .gmnoprint:first-child > div');
8
    let navigation = document.createElement('div');
9
10
    navigation.setAttribute('class', 'maps-editor__add-marker-container');
11
    navigation.innerHTML = `
12
        <div class="maps-editor__add-marker-subcontainer">
13
            <img src="${image}" draggable="false" class="maps-editor__add-new-marker" />
14
        </div>
15
    `;
16
17
    let separator = document.createElement('div');
18
19
    separator.setAttribute('class', 'maps-editor__separator');
20
21
    control.prepend(navigation);
22
    navigation.parentNode.insertBefore(separator, navigation.nextSibling);
23
24
    return navigation;
25
}