Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
}
},
"permissions": ["scripting", "webNavigation"],
"host_permissions": ["*://*/*"],
"host_permissions": [
"*://*/*",
"*://github.com/*",
"*://gitlab.com/*",
"*://bitbucket.org/*"
],
"web_accessible_resources": [
{
"resources": ["fonts/*"],
Expand Down
7 changes: 6 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ chrome.webNavigation.onCompleted.addListener(frame => {
target: { tabId: frame.tabId },
files: ["build/content_script.js"]
});
}, { url: [{ urlMatches: "https?:\/\/(dev\.azure\.com){1}[\/\w\d\sA-Za-z0-9-_]*(pullrequest\/[0-9])+" }] });
}, { url: [
{ urlMatches: "https?:\/\/(dev\.azure\.com){1}[\/\w\d\sA-Za-z0-9-_]*(pullrequest\/[0-9])+" },
{ urlMatches: "https?:\/\/(github\.com){1}[\/\w\d\sA-Za-z0-9-_]*(pull\/[0-9])+" },
{ urlMatches: "https?:\/\/(gitlab\.com){1}[\/\w\d\sA-Za-z0-9-_]*(merge_requests\/[0-9])+" },
{ urlMatches: "https?:\/\/(bitbucket\.org){1}[\/\w\d\sA-Za-z0-9-_]*(pull-requests\/[0-9])+" }
] });
2 changes: 1 addition & 1 deletion src/components/content-script/Decorations.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return;
}

const cssSelector = ".repos-pr-details-page";
const cssSelector = ".repos-pr-details-page, .js-discussion, .merge-request, .pr-review";
selected = !selected;
let parent = document.querySelector(cssSelector);
let target = <Element>event.currentTarget;
Expand Down
2 changes: 1 addition & 1 deletion src/components/content-script/Label.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
return;
}

const cssSelector = ".repos-pr-details-page";
const cssSelector = ".repos-pr-details-page, .js-discussion, .merge-request, .pr-review";
selected = !selected;
let parent = document.querySelector(cssSelector);
let target = <Element>event.currentTarget;
Expand Down
7 changes: 4 additions & 3 deletions src/content_script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import App from "./App.svelte";
import Container from "./components/content-script/Container.svelte";

//Element that we want to find
const selector = "textarea[aria-label=\"Add a comment\"]";
const selector = "textarea[aria-label=\"Add a comment\"], textarea[name=\"comment[body]\"], textarea[data-testid=\"comment-body-input\"], textarea[data-qa=\"comment-input\"]";
//Parent elements that defines where the comment box is, not the reply.
const greenAreaSelectors = [".bolt-timeline-first-row", ".repos-discussion-thread > div:first-child"];
const greenAreaSelectors = [".bolt-timeline-first-row", ".repos-discussion-thread > div:first-child", ".js-discussion", ".merge-request", ".pr-review"];


waitForElement(selector, (matches: Node[]) => {

// get all green area nodes from DOM
const greenAreas = document.querySelectorAll(greenAreaSelectors.join(','));

matches.forEach((value: Element) => {
const container = <HTMLDivElement>value.querySelector(".repos-comment-editor-fit");
const container = <HTMLDivElement>value.querySelector(".repos-comment-editor-fit, .timeline-comment, .note, .comment-thread");
const isItInCorrectArea = Array.from(greenAreas).find(x => x.contains(container)) != null;

if (container == null || isItInCorrectArea == false) {
Expand Down
2 changes: 1 addition & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export const defaultOptions: IOptions = {
"This decoration gives some freedom to the author that they should resolve the comment only if the changes ends up being minor or trivial.",
},
]
};
};
1 change: 0 additions & 1 deletion src/processor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import _ from 'lodash';
import { Writable, writable } from "svelte/store";
import { ConventionalCommentMatch, EmptyMatch, IItem, IOptions } from "./types";
Expand Down