message: Meta: Fix Refined GitHub sponsor button
diff: import cache from 'webext-storage-cache';
  import select from 'select-dom';
  import delegate from 'delegate-it';
  +import elementReady from 'element-ready';
  import * as pageDetect from 'github-url-detection';
  import features from '.';
  @@ -97,6 +98,20 @@ function handleSponsorButton(): void {
  delegate(document, '#sponsor-button-repo, #sponsor-profile-button, [aria-label^="Sponsor @"]', 'click', suchLove);
  }
  +// GitHub has a bug where the sponsor nudge does not reflect the funding.yml. Reported to GitHub, still not fixed.
  +// https://github.com/sindresorhus/refined-github/blob/891dec097db8f2581985efb131499986fb04b661/.github/funding.yml
  +async function fixGitHubSponsorsBug(): Promise<void> {
  + const wrongSponsorButton = await elementReady('[aria-label="Sponsor @sindresorhus"][data-hydro-click*="ISSUE_NUDGE_SPONSOR"]', {stopOnDomReady: false, timeout: 1000});
  + if (wrongSponsorButton) {
  + wrongSponsorButton.outerHTML = wrongSponsorButton.outerHTML.replace(/sindresorhus/g, 'fregante');
  + }
  +
  + const wrongSponsor = select('img[src$="sponsors/mona.png"] + span a[href="/sindresorhus"]');
  + if (wrongSponsor) {
  + wrongSponsor.outerHTML = wrongSponsor.outerHTML.replace(/sindresorhus/g, 'fregante');
  + }
  +}
  +
  void features.add(__filebasename, {
  include: [
  pageDetect.isIssue,
  @@ -111,4 +126,9 @@ void features.add(__filebasename, {
  pageDetect.isOrganizationProfile,
  ],
  init: handleSponsorButton,
  +}, {
  + include: [
  + () => location.pathname.startsWith('/sindresorhus/refined-github/issues/'),
  + ],
  + init: fixGitHubSponsorsBug,
  });
  