Skip to content
Snippets Groups Projects
Commit 59c3f0a2 authored by Vasili Gulevich's avatar Vasili Gulevich
Browse files

Fix project id detection

Issue #2
parent fb30bb2e
No related branches found
No related tags found
1 merge request!2A link to the origin from timer entry
......@@ -17,24 +17,21 @@
// @description Toggle button for GitHub
// ==/UserScript==
console.log("Toggl is here");
new TogglButtonGM('#partial-discussion-header', function (elem) {
var description, projectIds = [],
numElem = elem.querySelector('.gh-header-number', elem),
titleElem = elem.querySelector('.js-issue-title', elem),
authorElem = document.querySelector('.url.fn'),
projectElem = document.querySelector('.js-current-repository');
titleElem = elem.querySelector('.js-issue-title', elem);
description = titleElem.textContent.trim();
if (numElem !== null) {
description = numElem.textContent.trim() + " " + description;
}
if (authorElem !== null) {
projectIds.push(authorElem.textContent.trim());
}
if (projectElem !== null) {
projectIds.push(projectElem.textContent.trim());
}
var [, author, project] = window.location.pathname.split("/");
projectIds.push(author);
projectIds.push(project);
return {
className: 'github',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment