Skip to content

Commit

Permalink
Merge pull request #53 from leedrum/dev
Browse files Browse the repository at this point in the history
Correct endpoint, fixed selector elements
  • Loading branch information
leedrum authored Apr 27, 2024
2 parents 688ffde + fec46a0 commit 12102d4
Show file tree
Hide file tree
Showing 10 changed files with 7,542 additions and 17,288 deletions.
12,808 changes: 1,507 additions & 11,301 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@emotion/styled": "^11.10.4",
"@hot-loader/react-dom": "^17.0.2",
"@mui/material": "^5.10.6",
"caniuse-lite": "^1.0.30001612",
"date-fns": "^2.29.3",
"dom-chef": "^5.1.0",
"element-ready": "^6.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/containers/About/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const AboutComponent = () => {
<Row>
<Grid item xs={12}>
<Typography component={'p'}>
Version: 1.1.21
Version: 1.1.22
</Typography>
</Grid>
</Row>
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/faceit-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import pRetry from 'p-retry'
export const CACHE_TIME = 600000


const BASE_URL = 'https://api.faceit.com'
const BASE_URL = 'https://www.faceit.com/api'

export const faceitApii = async (path, options) => {
const response = await pRetry(
Expand Down Expand Up @@ -38,12 +38,12 @@ async function fetchApi(path) {
}

try {
const token = Cookies.get('t') || localStorage.getItem('token')
// const token = Cookies.get('t') || localStorage.getItem('token')
const options = { headers: {} }

if (token) {
options.headers.Authorization = `Bearer ${token}`
}
// if (token) {
// options.headers.Authorization = `Bearer ${token}`
// }

const response = await faceitApii(path, options)
if (!response) return null
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Faceit Exts",
"version": "1.1.21",
"version": "1.1.22",
"description": "Faceit Exts is a extension improve experience and adds some features",
"background": { "service_worker": "background.bundle.js" },
"host_permissions": ["https://api.faceit.com/"],
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json.firefox
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Faceit Exts",
"description": "Faceit Exts is a extension improve experience and adds some features",
"version": "1.1.21",
"version": "1.1.22",
"manifest_version": 2,
"permissions": [
"https://api.faceit.com/",
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Content/modules/add-player-profile-matches-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ const FEATURE_ATTRIBUTE = 'matches-demo'

export const PlayerProfileMatchesDemo = async parentElement => {
const playerProfileParasiteElement = select(
'parasite-player-profile-content',
'#parasite-container',
parentElement
)

if (!playerProfileParasiteElement) {
return
}

const playerProfileElement = select(
'div',
const playerProfileElement = select.all(
'#content-grid-element-0',
playerProfileParasiteElement
)
)[0]

const matchElements = select.all('table > tbody > tr', playerProfileElement)

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Content/modules/header-level-progress/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const FeatureHeaderLevelProgress = async () => {

let mainHeaderActionsElement = null
try {
mainHeaderActionsElement = document.querySelector("div[ui-view='header']").querySelector('#main-header-height-wrapper').querySelector('div')
mainHeaderActionsElement = document.querySelectorAll('[data-testid="mh-friends-icon-button"]')[0].parentElement;
} catch (error) {
return
}
Expand Down
16 changes: 8 additions & 8 deletions src/pages/Content/modules/player-profile-matches-elo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const FEATURE_ATTRIBUTE = 'matches-elo'

export const PlayerProfileMatchesElo = async parentElement => {
const playerProfileParasiteElement = select(
'parasite-player-profile-content',
'#parasite-container',
parentElement
)

if (!playerProfileParasiteElement) {
return
}

const playerProfileElement = select(
'div',
const playerProfileElement = select.all(
'#content-grid-element-0',
playerProfileParasiteElement
)
)[0]

const matchElements = select.all('table > tbody > tr', playerProfileElement)

Expand Down Expand Up @@ -66,25 +66,25 @@ export const PlayerProfileMatchesElo = async parentElement => {
if (
!match ||
match.i18 !== scoreElement.textContent.trim() ||
match.i1 !== mapElement.textContent.trim()
!match.i1.includes(mapElement.textContent.trim().toLowerCase())
) {
return
}

const eloChange = eloChangesByMatches[match.matchId]

console.log('eloChange', eloChange)
if (!eloChange) {
return
}

const { eloDiff, newElo } = eloChange

console.log('eloDiff', eloDiff)
if (!eloDiff) {
return
}

const resultElement = select('td:nth-child(3) span', matchElement)

console.log('resultElement', resultElement)
resultElement.textContent += ` (${eloDiff >= 0 ? '+' : ''}${eloDiff})`

const newEloElement = (
Expand Down
Loading

0 comments on commit 12102d4

Please sign in to comment.