A Firefox extension that adds a link to the raw patch view on GitHub commit pages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

patch-viewer.js 436B

123456789101112131415
  1. var ELEMENT_ID = 'viewPatchButton';
  2. var parent = document.querySelector('.commit');
  3. var sibling = parent.querySelector('.btn');
  4. var el = document.createElement('a');
  5. if (!document.querySelector('#' + ELEMENT_ID)) {
  6. el.href = window.location.href + '.patch';
  7. el.classList = 'btn btn-outline float-right';
  8. el.innerText = 'View as Patch';
  9. el.style.marginLeft = '1em';
  10. el.id = ELEMENT_ID;
  11. parent.insertBefore(el, sibling);
  12. }