Skip to content

Commit 1d1f228

Browse files
buschesfregante
authored andcommitted
Fix Console Errors (refined-github#1359)
* Fix console error when clicking on More (Next to releases) * Fix console error when on Gist page * Fix console error when on Gist profile page
1 parent 6e545b1 commit 1d1f228

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

source/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ async function init() {
109109
enableFeature(addTrendingMenuItem);
110110
}
111111

112-
if (pageDetect.isDashboard()) {
112+
if (pageDetect.isDashboard() && !pageDetect.isGist()) {
113113
enableFeature(hideUselessNewsfeedEvents);
114114
}
115115

source/features/close-out-of-view-modals.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ const observer = new IntersectionObserver(([{intersectionRatio, target}]) => {
1717
export default function () {
1818
delegate('.dropdown-details, .js-menu-target', 'click', event => {
1919
const button = event.delegateTarget;
20-
const modal = button
21-
.closest('.select-menu, .dropdown, details')
22-
.querySelector('.select-menu-modal, .dropdown-menu');
23-
if (modal && (!button.open || button.classList.contains('selected'))) {
24-
observer.observe(modal);
20+
const menu = button.closest('.select-menu, .dropdown, details');
21+
if (menu) {
22+
const modal = menu.querySelector('.select-menu-modal, .dropdown-menu');
23+
if (modal && (!button.open || button.classList.contains('selected'))) {
24+
observer.observe(modal);
25+
}
2526
}
2627
});
2728
}

source/features/copy-file.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export default function () {
1515

1616
// Prepend to list of buttons
1717
const firstAction = select('.file-actions .btn', file);
18-
firstAction.before(
19-
<button onClick={handleClick} class="btn btn-sm copy-btn tooltipped tooltipped-n" aria-label="Copy file to clipboard" type="button">Copy</button>
20-
);
18+
if (firstAction) {
19+
firstAction.before(
20+
<button onClick={handleClick} class="btn btn-sm copy-btn tooltipped tooltipped-n" aria-label="Copy file to clipboard" type="button">Copy</button>
21+
);
2122

22-
// Group buttons if necessary
23-
groupSiblings(firstAction);
23+
// Group buttons if necessary
24+
groupSiblings(firstAction);
25+
}
2426
}
2527
}

0 commit comments

Comments
 (0)