message: Enable `raw-file-link` on `isCompare`
diff: @@ -4,28 +4,24 @@ import delegate from 'delegate-it';
  import * as pageDetect from 'github-url-detection';
  import features from '.';
  +import GitHubURL from '../github-helpers/github-url';
  -function handleMenuOpening(event: delegate.Event): void {
  - const dropdown = event.delegateTarget.nextElementSibling!;
  -
  - // Only if it's not already there
  - if (select.exists('.rgh-raw-file-link', dropdown)) {
  - return;
  - }
  +function handleMenuOpening({delegateTarget: dropdown}: delegate.Event): void {
  + dropdown.classList.add('rgh-raw-file-link'); // Mark this as processed
  const viewFile = select<HTMLAnchorElement>('[data-ga-click^="View file"]', dropdown)!;
  - const url = viewFile.pathname.split('/');
  - url[3] = 'raw'; // Replaces 'blob'
  + const {href} = new GitHubURL(viewFile.href).assign({route: 'raw'});
  viewFile.after(
  - <a href={url.join('/')} className="pl-5 dropdown-item btn-link rgh-raw-file-link" role="menuitem">
  + <a href={href} className="pl-5 dropdown-item btn-link" role="menuitem">
  View raw
  </a>
  );
  }
  function init(): void {
  - delegate(document, '.js-file-header-dropdown > summary', 'click', handleMenuOpening);
  + // `useCapture` required to be fired before GitHub's handlers
  + delegate(document, '.file-header .js-file-header-dropdown:not(.rgh-raw-file-link)', 'toggle', handleMenuOpening, true);
  }
  void features.add({
  @@ -35,7 +31,8 @@ void features.add({
  }, {
  include: [
  pageDetect.isCommit,
  - pageDetect.isPRFiles
  + pageDetect.isPRFiles,
  + pageDetect.isCompare
  ],
  init
  });
  