Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/features/click-modal-close.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import select from 'select-dom'

export default parent => {
export default async parent => {
const closeButton = select('button[ng-click="cancel()"]', parent)

if (closeButton) {
Expand Down
2 changes: 1 addition & 1 deletion src/content/features/click-modal-inactive-check.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import select from 'select-dom'

export default parent => {
export default async parent => {
const resumeButton = select('button[ng-click="refresh()"]', parent)

if (resumeButton) {
Expand Down
2 changes: 1 addition & 1 deletion src/content/features/click-modal-match-queuing-continue.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import select from 'select-dom'

export default parent => {
export default async parent => {
const continueButton = select(
'button[ng-click="close()"][translate-once="CONTINUE"]',
parent
Expand Down
2 changes: 1 addition & 1 deletion src/content/features/click-modal-match-ready.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import select from 'select-dom'
import { notifyIf } from '../helpers/user-settings'

export default parent => {
export default async parent => {
// Quickmatch
let acceptButton = select(
'button[ng-click="close()"][translate-once="ACCEPT"]:not([disabled]',
Expand Down
2 changes: 1 addition & 1 deletion src/content/features/click-modal-match-room-captain-ok.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import select from 'select-dom'

export default parent => {
export default async parent => {
const okButton = select(
'button[ng-click="close()"][translate-once="OK"]',
parent
Expand Down
2 changes: 1 addition & 1 deletion src/content/features/click-modal-party-invite-accept.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import select from 'select-dom'
import { notifyIf } from '../helpers/user-settings'

export default parent => {
export default async parent => {
const acceptButton = select(
'button[ng-click="acceptInvite()"][translate-once="ACCEPT"]:not([disabled])',
parent
Expand Down
34 changes: 19 additions & 15 deletions src/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ function observeBody() {
}

const observer = new MutationObserver(mutationList => {
const modalElement = select('.modal-dialog')
;(async () => {
const modalElement = select('.modal-dialog')
if (!modalElement) {
return
}

if (modalElement) {
if (modals.isInviteToParty(modalElement)) {
runFeatureIf(
'partyAutoAcceptInvite',
Expand Down Expand Up @@ -108,7 +111,7 @@ function observeBody() {
debouncedPlayerProfileStatsFeatures(modalElement)
}
}
}
})()

runFeatureIf('headerShowElo', addHeaderLevelProgress)
runFeatureIf(
Expand All @@ -117,10 +120,11 @@ function observeBody() {
)

addSidebarMatchesElo()

const mainContentElement = select('#main-content')

if (mainContentElement) {
;(async () => {
const mainContentElement = select('#main-content')
if (!mainContentElement) {
return
}
if (pages.isRoomOverview() && matchRoomIsReady()) {
addMatchRoomPlayerBadges(mainContentElement)
addMatchRoomPlayerColors(mainContentElement)
Expand Down Expand Up @@ -181,18 +185,18 @@ function observeBody() {
mainContentElement
)
}
}

for (const mutation of mutationList) {
for (const addedNode of mutation.addedNodes) {
if (addedNode.shadowRoot) {
})()
;(async () => {
mutationList
.flatMap(mutation => mutation.addedNodes)
.filter(node => node.shadowRoot)
.forEach(addedNode => {
observer.observe(addedNode.shadowRoot, {
childList: true,
subtree: true
})
}
}
}
})
})()
})

observer.observe(document.body, { childList: true, subtree: true })
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const CleanWebpackPlugin = require('clean-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
devtool: process.env.NODE_ENV === 'production' ? false : 'sourcemap',
devtool: process.env.NODE_ENV === 'production' ? false : 'inline-source-map',
context: path.resolve(__dirname, 'src'),
entry: {
content: './content/index.js',
Expand Down