Skip to content
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

v0.2: observe page changes and inject the script before page load #3

Merged
merged 6 commits into from
Feb 9, 2023
Merged
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
Prev Previous commit
Next Next commit
script: (EnsureCommentButton) create comment button only when there i…
…s no comment-button element

Signed-off-by: Aolin <aolinz@outlook.com>
  • Loading branch information
Oreoxmt committed Feb 9, 2023
commit aedc149875cd3d32322676fa9c02d143fa20636f
4 changes: 4 additions & 0 deletions gh-util.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@
}

// TODO: Use toggle instead of button, and add more features to the toggle, e.g., editing tokens.
function EnsureCommentButton() {
const MARK = 'comment-button'
if (document.querySelector(`button[${ATTR}="${MARK}"]`)) {
return;
}
// First, find the "table-list-header-toggle" div
var toggleDiv = document.querySelector('.table-list-header-toggle.float-right');

Expand Down