Skip to content

Commit

Permalink
Implement mozreview button.
Browse files Browse the repository at this point in the history
  • Loading branch information
jankeromnes committed Dec 8, 2017
1 parent 2f78a85 commit 7a6f0d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"js": ["github-buttons.js"]
},
{
"matches": ["*://reviewboard.mozilla.org/*"],
"matches": ["*://reviewboard.mozilla.org/r/*"],
"js": ["mozreview-buttons.js"]
},
{
Expand Down
27 changes: 27 additions & 0 deletions mozreview-buttons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const revision = document.querySelector('#review-request-inputs').firstElementChild.value.match(/[0-9a-f]+/)[0];

// Create 'build in janitor' link.
const a = document.createElement('a');
a.href = '#';
a.target = '_blank';
a.title = 'Build patches in Janitor';
a.textContent = 'Janitor ▾';
a.style.color = 'white';

const li = document.createElement('li');
li.classList.add('has-menu');
li.style.backgroundColor = '#007EC6';
li.appendChild(a);

const menu = document.createElement('ul');
menu.classList.add('menu');
menu.style.display = 'none';
menu.innerHTML =
'<li><a href="https://janitor.technology/create/?project=firefox-hg&revision=' +
revision + '" target="_blank" title="Build patches on Ubuntu 16.04">Build on Linux</a></li>' +
'<li><a href="https://janitor.technology/create/?project=firefox-windows&revision=' +
revision + '" target="_blank" title="Build patches on Windows 10">Build on Windows</a></li>';
li.appendChild(menu);

const buttons = document.querySelector('.actions .actions-right');
buttons.insertBefore(li, buttons.querySelector('.primary'));

0 comments on commit 7a6f0d2

Please sign in to comment.