Created
November 19, 2020 14:06
-
-
Save natecraddock/e390c3d57a08e36e8b7a3564e75c713a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// ==UserScript== | |
// @name Phabricator Move Comment Box | |
// @version 1 | |
// @match https://developer.blender.org/D* | |
// @description Move the phabricator comment form to a more reasonable location | |
// ==/UserScript== | |
// Util for inserting after nodes | |
function insertAfter(newNode, existingNode) { | |
existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling); | |
} | |
let commentBox = document.querySelector('[data-sigil="phui-comment-form"]'); | |
let preview = document.querySelector('[class="phui-comment-preview-view"]'); | |
let toc = document.querySelector('[name="toc"]'); | |
if (commentBox && preview && toc) { | |
commentBox.remove(); | |
preview.remove(); | |
let navMarker = toc.previousSibling; | |
navMarker.parentNode.insertBefore(commentBox, navMarker); | |
insertAfter(preview, commentBox); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment