Skip to content

Commit

Permalink
Cleanup recently-pushed-branches-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Nov 12, 2020
1 parent 3caa8c8 commit ffc630c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions source/features/recently-pushed-branches-enhancements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,17 @@ import {buildRepoURL} from '../github-helpers';
const fragmentURL = buildRepoURL('show_partial?partial=tree%2Frecently_touched_branches_list');
const selector = `[data-url='${fragmentURL}' i], [src='${fragmentURL}' i]`;

// Ajaxed pages will load a new fragment on every ajaxed load;
// but we only really need the one generated on the first load
// Ajaxed pages will load a new fragment on every ajaxed load, but we only really need the one generated on the first load
function removeDuplicateList(): void {
const duplicate = select(selector, select('main')!);

if (duplicate) {
duplicate.remove();
}
select(selector, select('main')!)?.remove();
}

async function getWidget(): Promise<HTMLElement | false> {
if (pageDetect.isRepoRoot()) {
return select(selector)!;
}

// We need to verify that the repo has any recently pushed branches or else it will break the page
// https://github.com/sindresorhus/refined-github/issues/1964
// We need to verify that the repo has any recently pushed branches or else it will break the page #1964
const repoRootUrl = location.pathname.split('/', 3).join('/');
const response = await fetch(location.origin + repoRootUrl);
const html = await response.text();
Expand Down

0 comments on commit ffc630c

Please sign in to comment.