-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Themes: Hide "Theme Showcase" broken action (#36986)
Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/8754221266 Upstream-Ref: Automattic/jetpack@18edd35
- Loading branch information
Showing
6 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
vendor/automattic/jetpack-mu-wpcom/src/features/wpcom-themes/js/theme-actions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const wpcomThemesRemoveWpcomActions = () => { | ||
const themeOverlay = document.querySelector( '.theme-overlay' ); | ||
if ( ! themeOverlay ) { | ||
return; | ||
} | ||
|
||
const observer = new MutationObserver( mutations => { | ||
for ( const mutation of mutations ) { | ||
for ( const node of mutation.addedNodes ) { | ||
// If this is not an overlay for the active theme, bail and check the next node. | ||
if ( | ||
! node.classList.contains( 'theme-overlay' ) || | ||
! node.classList.contains( 'active' ) | ||
) { | ||
continue; | ||
} | ||
|
||
const themeActions = node.querySelector( '.theme-actions .active-theme' ); | ||
for ( const action of themeActions?.children ?? [] ) { | ||
if ( action.getAttribute( 'href' )?.includes( 'https://wordpress.com' ) ) { | ||
themeActions.removeChild( action ); | ||
} | ||
} | ||
return; | ||
} | ||
} | ||
} ); | ||
|
||
observer.observe( themeOverlay, { childList: true } ); | ||
}; | ||
|
||
document.addEventListener( 'DOMContentLoaded', wpcomThemesRemoveWpcomActions ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters