Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
steinybot committed Jun 11, 2024
1 parent 3248f88 commit eb61775
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion source/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ function onLoad() {
console.debug('onLoad')
observeNewStoryContent()
observeNewMainPosts()
// TODO: Maybe this should only be added on the story page?
observeStoryMain()
}

Expand Down
3 changes: 1 addition & 2 deletions source/main-posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function maybeAddOpenInTabLink(child: HTMLElement, postId: string, dataType: Pos
return result.length > 0
}

function observePost(post: HTMLElement, postType: "story") {
function observePost(post: HTMLElement, postType: 'story') {
const postId = $(post).attr('data-post-id') ?? ''
const selector = postSelector(postType)
// The post gets added but the contents isn't there until a bit later.
Expand Down Expand Up @@ -91,7 +91,6 @@ export function observeNewMainPosts() {
console.debug(`Ignoring post type: ${postType}`)
} else {
console.warn(`Unknown post type: ${postType}`)
debugger
}
}
})
Expand Down
3 changes: 0 additions & 3 deletions source/observation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export function onElementsAdded<Element extends HTMLElement = HTMLElement>(
root: Node,
selector: FindSelector<Element>,
f: (elements: Element[], observer: MutationObserver) => void): void {
//console.debug('Observing added elements that match selector', selector)
// This is a bit hacky but will work so long as we remember to include spaces in any descendent selectors.
const isLocal = isLocalSelector(selector)
const find: () => JQuery<Element> = () => $(root).find<Element>(selector)
Expand All @@ -119,15 +118,13 @@ export function onElementsAdded<Element extends HTMLElement = HTMLElement>(
}

if (addedElements.length > 0) {
//console.debug('Added elements', addedElements)
f(addedElements, observer)
}
})
observer.observe(root, {childList: true, subtree: true})
const existingElements = find()
if (existingElements.length > 0) {
const elements = existingElements.get()
//console.debug('Existing elements', elements)
f(elements, observer)
}
}
Expand Down

0 comments on commit eb61775

Please sign in to comment.