Skip to content
This repository was archived by the owner on Nov 11, 2025. It is now read-only.
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion content_script.js
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
//TODO: Code, der auf trello.com ausgeführt wird
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.querySelectorAll(".mod-no-top-margin")[1].classList.remove("mod-no-top-margin")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das hier nimmt vom zweiten Element der Liste die Klasse weg. Ist das beabsichtigt oder meintest du das erste? Das wäre dann ...)[0]. Brauchts das überhaupt. Der margin stört doch nicht oder?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das zweite ist schon richtig, mod-no-top-margin soll von der h3 entfernt werden, damit diese einen Abstand zum Button hat

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aber innerhalb der sidebar der zweite? Der button kommt doch vor die erste h3 oder? Du machst ja sidebar.querySelectorAll. Da bekommst du nur Elemente innerhalb der sidebar, nicht das da links.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, mir fällt gerade auf, dass es bei einigen Karten noch ein .mod-no-top-margin in der sidebar gibt und bei einigen nicht...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaa ok. ich überlass die entscheidung dir. ich finds wie gesagt grad nicht so wichtig. wichtiger ist die funktionalität. hübsch machen, geht später immernoch.

}

function onClick(){
alert("work in progress ;)")
}

window.addEventListener("pushstate", function(){
if(window.location.pathname.startsWith("/c/")){
addButton()
}
})