diff options
author | Dominic DiTaranto <domdit@gmail.com> | 2024-08-23 23:32:26 -0400 |
---|---|---|
committer | Dominic DiTaranto <domdit@gmail.com> | 2024-08-23 23:32:26 -0400 |
commit | 26ee0a64973a16584f8d51686ab357acfd526ee9 (patch) | |
tree | 38401cbf5e8d6fd05e879782b64189d9368edc1d /buttonList.js |
Diffstat (limited to 'buttonList.js')
-rw-r--r-- | buttonList.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/buttonList.js b/buttonList.js new file mode 100644 index 0000000..2b80165 --- /dev/null +++ b/buttonList.js @@ -0,0 +1,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()
\ No newline at end of file |