summaryrefslogtreecommitdiff
path: root/buttonList.js
blob: 2b801654e149ca6da60a23c5ba7987e6b8cfa10e (plain)
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
function createStickyButtons() {
    var supportedColors = [
        "Cornsilk",
        "LightPink",
        "LightCyan",
        "MintCream",
        "Gainsboro",
        "HoneyDew",
        "LightCoral",
        "LightSalmon",
        "Plum"
    ]

    var buttonList = document.getElementById('buttonList')

    for (let i = 0; i < supportedColors.length; i++){
        var btn = document.createElement('button')
        btn.classList.add('new-sticky-button')
        btn.onclick = function() {
            chrome.tabs.query({active: true, currentWindow: true}, tabs => {
                chrome.tabs.sendMessage(tabs[0].id, {color: supportedColors[i]}, response => {});
            });
        }

        btn.style.backgroundColor = supportedColors[i];
        buttonList.appendChild(btn)
    }
}

createStickyButtons()