-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmacbutton-creation.js
32 lines (24 loc) · 963 Bytes
/
macbutton-creation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"use strict"
let macDivs = document.querySelectorAll("pre");
let macArrayDivs = Array.prototype.slice.call(macDivs);
macArrayDivs.map(element => {
//General button bar
const buttonBar = document.createElement('div')
buttonBar.classList.add('buttons-bar')
//Buttons area
const buttonsArea =document.createElement('div')
buttonsArea.classList.add('buttons-area')
buttonBar.appendChild(buttonsArea)
//Button
const redButton = document.createElement('div')
redButton.classList.add('mac-button', 'red')
const yellowButton = document.createElement('div')
yellowButton.classList.add('mac-button', 'yellow')
const greenButton = document.createElement('div')
greenButton.classList.add('mac-button', 'green')
buttonsArea.appendChild(redButton)
buttonsArea.appendChild(yellowButton)
buttonsArea.appendChild(greenButton)
element.prepend(buttonBar)
console.log(buttonBar)
})