Last active
August 31, 2017 07:35
-
-
Save quanon/0d740a46de07b10adf0789f108084535 to your computer and use it in GitHub Desktop.
GitHub Issue Link for Markdown
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 GitHub Issue Link for Markdown | |
// @version 0.1 | |
// @author QUANON | |
// @match https://github.com/*/*/issues/* | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
'use strict'; | |
const repositryName = document.querySelector('h1.public').textContent.trim(); | |
const issueNo = document.querySelector('.gh-header-number').textContent.trim(); | |
const issueTitle = document.querySelector('.js-issue-title').textContent.trim(); | |
const url = window.location.href; | |
const input = document.createElement('input'); | |
input.setAttribute('type', 'text'); | |
input.setAttribute('value', `[${repositryName} » Issue ${issueNo} » ${issueTitle}](${url})`); | |
input.setAttribute('readonly', true); | |
input.setAttribute('style', 'width: 100%; margin-bottom: 15px;'); | |
input.addEventListener('click', () => { | |
input.select(); | |
}, false); | |
document | |
.getElementById('partial-discussion-header') | |
.appendChild(input); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment