-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetpack live branches: fix, simplify and refactor #11761
Conversation
- Add more settings - Add more plugins - Remove GitHub's own classnames from HTML; this was causing fatal error in the page each time checkboxes were toggled - Wrap checkbox texts in label to make them clickable - Tell linter that jQuery is global variable - Change how link is structured - Change how HTML is structured - Move link under the settings from above
appendHtml( markdownBody, '<p><strong>This branch is already merged.</strong></p>' ); | ||
} | ||
|
||
function getLink() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of modifying the URL, we just re-generate it on each time. Feels more straightforward code-wise.
const div = document.createElement( 'div' ); | ||
function getOptionsList( options, columnWidth ) { | ||
return ` | ||
<ul style="list-style: none; padding-left: 0; display: flex; flex-wrap: wrap;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline CSS instead of relying on Github, because relying on those classes was causing occasional JS fatal errors.
This is an automated check which relies on |
Feels like it would be more natural for this script to live in Jurassic Ninja repository? That way we could make this more generic and inject these also in WooCommerce and other repositories that Jurassic Ninja supports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well for me! 🚢
I had a small evening inspiration moment so I went on and worked a bit on this script.
Use of GitHub's
task-list-item
,task-list-item-checkbox
etc classes was sometimes causing Live branches to fail to work; it's a bit hard to replicate as it's probably a race condition depending on if Tampermonkey or GitHub's scripts load first.While at it, I refactored and added more settings and plugins.
I hope the code is now also easier to grok and extend with these changes.
Before
After
Changes proposed in this Pull Request:
Testing instructions:
Add script to Tampermonkey and refresh this page. :-)
Proposed changelog entry for your changes: