Last active
November 27, 2024 03:24
-
-
Save lionel-rowe/472d3de7738494746e5015d31220b748 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 Revert GitHub PR Title Truncation | |
// @namespace https://github.com/lionel-rowe/ | |
// @version 0.2 | |
// @description Revert GitHub PR Title Truncation | |
// @author https://github.com/lionel-rowe/ | |
// @match https://github.com/*/compare/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com | |
// @grant none | |
// ==/UserScript== | |
// https://github.com/orgs/community/discussions/12450 | |
const $title = document.getElementsByName('pull_request[title]')[0] | |
const $body = document.getElementsByName('pull_request[body]')[0] | |
const ellipsis = '…' | |
if ($title?.value.endsWith(ellipsis) && $body?.value.startsWith(ellipsis)) { | |
const [first, ...rest] = $body.value.split('\n') | |
$title.value = $title.value.slice(0, -ellipsis.length) + $body.value.slice(ellipsis.length) | |
$body.value = [...rest].join('\n').trimStart() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment