diff --git a/content_script.js b/content_script.js index dfe2f88..dfe5d44 100644 --- a/content_script.js +++ b/content_script.js @@ -1 +1,28 @@ -//TODO: Code, der auf trello.com ausgeführt wird \ No newline at end of file +function addButton(){ + const sidebar = document.querySelector(".window-sidebar") + const button = document.createElement('span'); + button.classList.add('button-link'); + button.addEventListener('click', onClick); + sidebar.prepend(button); + + const buttonIcon = document.createElement('span'); + buttonIcon.classList.add('icon-sm', 'plugin-icon'); + buttonIcon.innerText = '+'; + button.append(buttonIcon); + + const buttonText = document.createElement('span'); + buttonText.innerText = 'Toggl Task'; + button.append(buttonText); + + sidebar.querySelector(".js-sidebar-add-heading").classList.remove("mod-no-top-margin") +} + +function onClick(){ + alert("work in progress ;)") +} + +window.addEventListener("pushstate", function(){ + if(window.location.pathname.startsWith("/c/")){ + addButton() + } +})