summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Federico Brigante <me@fregante.com> 2020-11-12 01:04:13 -0600
committerGravatar Federico Brigante <me@fregante.com> 2020-11-12 01:04:13 -0600
commitffc630c1f72686096bcb59d22453747a500f0f92 (patch)
treeae9c52d975921541fc20999a9f181194364169b7
parent3caa8c8bdc4635bc53f61cc0e38182add2c828f3 (diff)
downloadrefined-github-ffc630c1f72686096bcb59d22453747a500f0f92.tar.gz
refined-github-ffc630c1f72686096bcb59d22453747a500f0f92.tar.zst
refined-github-ffc630c1f72686096bcb59d22453747a500f0f92.zip
Cleanup `recently-pushed-branches-enhancements`20.11.12
-rw-r--r--source/features/recently-pushed-branches-enhancements.tsx12
1 files changed, 3 insertions, 9 deletions
diff --git a/source/features/recently-pushed-branches-enhancements.tsx b/source/features/recently-pushed-branches-enhancements.tsx
index 9ca4b5f4..53c8ad62 100644
--- a/source/features/recently-pushed-branches-enhancements.tsx
+++ b/source/features/recently-pushed-branches-enhancements.tsx
@@ -10,14 +10,9 @@ 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> {
@@ -25,8 +20,7 @@ async function getWidget(): Promise<HTMLElement | false> {
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();