Skip to content

Instantly share code, notes, and snippets.

@tkdn
Last active December 28, 2021 04:52
Show Gist options
  • Save tkdn/f8fcf637fc2bc60e01f64ee7025186c3 to your computer and use it in GitHub Desktop.
Save tkdn/f8fcf637fc2bc60e01f64ee7025186c3 to your computer and use it in GitHub Desktop.
SHA 短いのがクリップボードにほしい
// ==UserScript==
// @name 出、出~短管理識別子取奴〜
// @namespace https://gist.github.com/tkdn/f8fcf637fc2bc60e01f64ee7025186c3#file-github-copy-short-sha.user.js
// @updateURL https://gist.githubusercontent.com/tkdn/f8fcf637fc2bc60e01f64ee7025186c3/raw/58daa1a22a7845d838efc1786c30c96acc7ce050/github-copy-short-sha.user.js
// @downloadURL https://gist.githubusercontent.com/tkdn/f8fcf637fc2bc60e01f64ee7025186c3/raw/58daa1a22a7845d838efc1786c30c96acc7ce050/github-copy-short-sha.user.js
// @version 0.1
// @description GitHub の SHA コピーを短いやつにする
// @author tkdn <[email protected]>
// @match https://github.com/*/*
// @grant none
// ==/UserScript==
(() => {
console.log('出、出~短管理識別子取奴〜')
setup()
document.addEventListener('pjax:end', setup)
function setup() {
const $elems = document.querySelectorAll('clipboard-copy[aria-label="Copy the full SHA"]')
$elems.forEach(elem => {
elem.value = elem.value.substring(0,8)
})
}
function sleep(ms) {
return new Promise(r => setTimeout(r, ms))
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment