Skip to content

Commit

Permalink
Drop outdated code
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Dec 20, 2023
1 parent cca12d3 commit 874f1b6
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions source/npmhub.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,15 @@ function getPackageURL() {
// Example URLs:
// https://github.com/npmhub/npmhub
// https://github.com/eslint/eslint/tree/main/packages/eslint-config-eslint
return document.querySelector([
'.react-directory-filename-column :is(a[title="package.json"], [title="package.json"] a)',
'#files ~ div [title="package.json"]', // GitHub pre-2022 refresh
])?.href;
return document.querySelector(`
.react-directory-filename-column :is(
a[title="package.json"],
[title="package.json"] a
)
`)?.href;
}

async function init() {
// If this fragment exists, then the list is deferred.
// Adapted from https://github.com/sindresorhus/refined-github/blob/b141596/source/github-events/on-file-list-update.ts
const ajaxFiles = await elementReady('#files ~ include-fragment[src*="/file-list/"]');
if (ajaxFiles) {
await new Promise(resolve => {
new MutationObserver(resolve).observe(ajaxFiles.parentNode, {
childList: true,
});
});
}

if (
document.querySelector('.npmhub-header')
|| !hasPackageJson()
Expand Down

0 comments on commit 874f1b6

Please sign in to comment.