Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion src/button/button-contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ export const buttonContributions: ButtonContributionParams[] = [
},
],
},
{
id: "gl-repo-empty",
exampleUrls: ["https://gitlab.com/filiptronicek/empty"],
selector: `xpath://*[@id="js-project-show-empty-page"]/div[1]/div[1]/div[2]`,
containerElement: { type: "div", props: { marginLeft: "8px" } },
application: "gitlab",
},
{
id: "gl-file",
exampleUrls: [
Expand Down Expand Up @@ -412,7 +419,8 @@ export const buttonContributions: ButtonContributionParams[] = [
],
selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons
containerElement: createElement("div", {}),
insertBefore: 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu)
insertBefore:
'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu)
application: "bitbucket",
},
{
Expand Down
3 changes: 3 additions & 0 deletions src/contents/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class ButtonContributionManager {
return this.buttons.get(this.getContainerId(this.active.contribution));
}

/**
* Checks if the contribution applies to the current page.
*/
private isActive(contrib: ButtonContributionParams) {
if (typeof contrib.match === "function" && !contrib.match()) {
return false;
Expand Down
12 changes: 10 additions & 2 deletions test/src/button-contributions-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ export const buttonContributions: ButtonContributionParams[] = [
},
],
},
{
id: "gl-repo-empty",
exampleUrls: ["https://gitlab.com/filiptronicek/empty"],
selector: `xpath://*[@id="js-project-show-empty-page"]/div[1]/div[1]/div[2]`,
containerElement: { type: "div", props: { marginLeft: "8px" } },
application: "gitlab",
},
{
id: "gl-file",
exampleUrls: [
Expand Down Expand Up @@ -410,9 +417,10 @@ export const buttonContributions: ButtonContributionParams[] = [
exampleUrls: [
// "https://bitbucket.org/efftinge/browser-extension-test/pull-requests/1"
],
selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons
selector: 'xpath://*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div', // grandparent div of the "Request changes" and "Approve" buttons
containerElement: createElement("div", {}),
insertBefore: 'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu)
insertBefore:
'xpath:(//*[@id="main"]/div/div/div[1]/div/div/div/div[1]/div/div[2]/div/div[2]/div/div/div)[last()]', // note the [last()] to insert before the last child (the kebab menu)
application: "bitbucket",
},
{
Expand Down
Loading