Skip to content

Commit

Permalink
Hide the button outside of GitHub and Trac
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Jun 11, 2024
1 parent 326d2eb commit 5f688eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Binary file modified packages/edit-visually-browser-extension/extension.zip
Binary file not shown.
12 changes: 10 additions & 2 deletions packages/edit-visually-browser-extension/src/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,17 @@ var enableEditInPlaygroundButton = function () {
hideButton(button);
});
function showButtonIfNeeded(element) {
if (element.tagName === 'TEXTAREA' || element.isContentEditable) {
showButton(element);
const domain = window.location.hostname;
if (
!domain.endsWith('github.com') &&
domain !== 'meta.trac.wordpress.org'
) {
return;
}
if (element.tagName !== 'TEXTAREA' && !element.isContentEditable) {
return;
}
showButton(element);
}
let buttonInterval;
function showButton(element) {
Expand Down
12 changes: 10 additions & 2 deletions packages/edit-visually-browser-extension/src/content-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ function enableEditInPlaygroundButton() {
});

function showButtonIfNeeded(element: any) {
if (element!.tagName === 'TEXTAREA' || element!.isContentEditable) {
showButton(element);
const domain = window.location.hostname;
if (
!domain.endsWith('github.com') &&
domain !== 'meta.trac.wordpress.org'
) {
return;
}
if (element!.tagName !== 'TEXTAREA' && !element!.isContentEditable) {
return;
}
showButton(element);
}

let buttonInterval: any;
Expand Down

0 comments on commit 5f688eb

Please sign in to comment.