feat: add nixpkgs-review button to user script
This commit is contained in:
parent
d7c79cbadd
commit
8ab83e7487
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
function addButton() {
|
function addButton() {
|
||||||
const buttonContainerElement = document.querySelector('.gh-header-actions');
|
const buttonContainerElement = document.querySelector('.gh-header-actions');
|
||||||
|
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.classList = 'flex-md-order-2 pr_tracker';
|
div.classList = 'flex-md-order-2 pr_tracker';
|
||||||
const pr= window.location.pathname.split('/')[4];
|
const pr= window.location.pathname.split('/')[4];
|
||||||
|
@ -18,12 +19,28 @@ function addButton() {
|
||||||
const btn = document.createElement('button');
|
const btn = document.createElement('button');
|
||||||
btn.classList = 'Button--secondary Button--small Button';
|
btn.classList = 'Button--secondary Button--small Button';
|
||||||
btn.type = 'button';
|
btn.type = 'button';
|
||||||
btn.innerText = `Subscribe`;
|
btn.innerText = `nim add`;
|
||||||
btn.addEventListener('click', function() {
|
btn.addEventListener('click', function() {
|
||||||
navigator.clipboard.writeText("nim add-pr " + pr);
|
navigator.clipboard.writeText("nim add-pr " + pr);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
div.appendChild(btn);
|
||||||
|
buttonContainerElement.firstElementChild.before(div);
|
||||||
|
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.classList = 'flex-md-order-2 pr_tracker';
|
||||||
|
const pr= window.location.pathname.split('/')[4];
|
||||||
|
|
||||||
|
const btn = document.createElement('button');
|
||||||
|
btn.classList = 'Button--secondary Button--small Button';
|
||||||
|
btn.type = 'button';
|
||||||
|
btn.innerText = `nixpkgs-review`;
|
||||||
|
btn.addEventListener('click', function() {
|
||||||
|
navigator.clipboard.writeText("nixpkgs-review pr " + pr);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
div.appendChild(btn);
|
div.appendChild(btn);
|
||||||
buttonContainerElement.firstElementChild.before(div);
|
buttonContainerElement.firstElementChild.before(div);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue