Skip to content

Commit

Permalink
Merge pull request #8 from Gaohaoyang/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Gaohaoyang authored Oct 2, 2024
2 parents f27c972 + f803226 commit 16c6b0f
Show file tree
Hide file tree
Showing 10 changed files with 665 additions and 244 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
# PTE Core Sub-Scores
# PTE Sub-Scores Breakdown

Chrome Extension for PTE Core Sub-Scores. Visit your PTE score page, then you will see a panel including your sub-scores, CLB levels, etc.
Chrome Extension for PTE Sub-Scores Breakdown. Simply visit your PTE score page, and you will see displaying your sub-scores, equivalent IELTS scores, CLB levels, and more.

<p align="center">
<img src="https://cdn.jsdelivr.net/gh/Gaohaoyang/pics/pte/1.png" alt="PTE core sub-scores" width="640"/>
<img src="https://cdn.jsdelivr.net/gh/Gaohaoyang/pics/pte/screenshot1.png" alt="PTE core sub-scores" width="640"/>
</p>

Get the full potential of your PTE Core Sub-Scores! Simply visit your PTE score page, where you’ll find a detailed breakdown of your performance, including your sub-scores, CLB levels, and more. Dive into this insightful panel to better understand your strengths and areas for improvement. Take control of your PTE journey today!
Get the full potential of your PTE Sub-Scores! Simply visit your PTE score page, where you’ll find a detailed breakdown of your performance, including your sub-scores, CLB levels, and more. Dive into this insightful panel to better understand your strengths and areas for improvement. Take control of your PTE journey today!

## Features

- **PTE Core Sub-Scores**
- **PTE Core Sub-Scores Breakdown**
- **CLB Levels**
- **Equivalent to IELTS (G) Score**
- **Points for EE** (With or Without Spouse, or As a Spouse)
- **PTE Scores and Sub-Scores**
- **PTE Sub-Scores Breakdown**
- **Support PTE Academic and PTE Core**
- **Equivalent to IELTS Score**
- **CLB Levels (PTE Core)**
- **Points for EE (PTE Core)** (With or Without Spouse, or As a Spouse)
- **Draggable Panel**

## How to use

<ul className="mt-1">
<li>1. Install the <a href="https://chromewebstore.google.com/detail/pte-core-sub-scores/hibclclepijigjnfdkmkfhjogfhgicda">PTE Core Sub-Scores Chrome Extension from the Chrome Web Store</a></li>
<li>1. Install the <a href="https://chromewebstore.google.com/detail/pte-core-sub-scores/hibclclepijigjnfdkmkfhjogfhgicda">PTE Sub-Scores Chrome Extension from the Chrome Web Store</a></li>
<li>
2. Visit your
<a
Expand All @@ -32,7 +33,7 @@ Get the full potential of your PTE Core Sub-Scores! Simply visit your PTE score
</li>
</ul>

![](https://cdn.jsdelivr.net/gh/Gaohaoyang/pics/pte/0.png)
![](https://cdn.jsdelivr.net/gh/Gaohaoyang/pics/pte/screenshot2.png)

## Donation

Expand Down
44 changes: 30 additions & 14 deletions injected.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(function (xhr) {
var XHR = XMLHttpRequest.prototype;
;(function (xhr) {
var XHR = XMLHttpRequest.prototype

var open = XHR.open;
var send = XHR.send;
var open = XHR.open
var send = XHR.send

XHR.open = function (method, url) {
this._method = method;
this._url = url;
return open.apply(this, arguments);
};
this._method = method
this._url = url
return open.apply(this, arguments)
}

XHR.send = function (postData) {
// console.log(
Expand All @@ -20,14 +20,30 @@
// );
this.addEventListener('load', function () {
if (
this._url.indexOf('https://api.mypte.pearsonpte.com/appointments/api/scorereport/') !== -1 && this._url.indexOf('/skills') === -1
this._url.indexOf(
'https://api.mypte.pearsonpte.com/appointments/api/scorereport/',
) !== -1 &&
this._url.indexOf('/skills') === -1
) {
window.postMessage({ type: 'xhr', data: this.response }, '*'); // send to content script
window.postMessage(
{ type: 'xhr-scorereport', data: this.response },
'*',
) // send to content script
}
});
return send.apply(this, arguments);
};
})(XMLHttpRequest);
if (
this._url.indexOf(
'https://api.mypte.pearsonpte.com/appointments/api/appointments',
) !== -1
) {
window.postMessage(
{ type: 'xhr-appointments', data: this.response },
'*',
) // send to content script
}
})
return send.apply(this, arguments)
}
})(XMLHttpRequest)

// const { fetch: origFetch } = window;
// window.fetch = async (...args) => {
Expand Down
18 changes: 11 additions & 7 deletions manifest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ const [major, minor, patch, label = '0'] = version
export default defineManifest(async (env) => ({
manifest_version: 3,
icons: {
"16": "images/16.png",
"32": "images/32.png",
"48": "images/48.png",
"128": "images/128.png",
'16': 'images/16.png',
'32': 'images/32.png',
'48': 'images/48.png',
'128': 'images/128.png',
},
name: env.mode === 'staging' ? '[INTERNAL] PTE Core Sub-Scores' : 'PTE Core Sub-Scores',
description: 'PTE Core Sub-Scores. Visit your PTE score page, then you will see a panel including your sub-scores, CLB levels, etc.',
name:
env.mode === 'staging'
? '[INTERNAL] PTE Sub-Scores Breakdown'
: 'PTE Sub-Scores Breakdown',
description:
'PTE Sub-Scores Breakdown. Simply visit your PTE score page, and you will see displaying your sub-scores, equivalent IELTS scores, CLB levels, and more.',
version: `${major}.${minor}.${patch}.${label}`,
version_name: version,
action: { default_popup: 'index.html' },
Expand All @@ -41,4 +45,4 @@ export default defineManifest(async (env) => ({
matches: ['https://mypte.pearsonpte.com/*'],
},
],
}));
}))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pte-crx",
"private": true,
"version": "1.2.2",
"version": "1.3.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function App() {
return (
<div className="w-96 bg-slate-50 p-3 text-sm text-slate-800">
<h1 className="text-center text-lg font-bold">Welcome to use</h1>
<h1 className="text-center text-2xl font-bold">PTE Core Sub-Scores</h1>
<h1 className="text-center text-2xl font-bold">PTE Sub-Scores</h1>
<h1 className="text-center text-lg font-bold">Chrome Extension!</h1>
<ul className="mt-1">
<li>
Expand All @@ -22,7 +22,7 @@ function App() {
</a>
</li>
<li>
2. Then you'll see a panel including your sub-scores, CLB levels, etc.
2. Then you'll see a panel including your sub-scores.
</li>
</ul>
<div className="mt-2">
Expand Down Expand Up @@ -50,7 +50,8 @@ function App() {
<tbody>
<tr className="border-b border-slate-400">
<td className="border-r border-slate-400 py-4">
<i>Interac</i> e-Transfer
<i>Interac</i> e-Transfer <br/>
(Canada)
</td>
<td>gaohaoyang126@outlook.com</td>
</tr>
Expand Down
131 changes: 131 additions & 0 deletions src/ContentUI/PTEAcademicTable/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import {
PiBookOpenUser,
PiHeadphones,
PiPenNib,
PiChatsCircle,
} from 'react-icons/pi'
import { getEqualScoresOfPTEAcademic } from '../scoreList'

interface PTEAcademicTableProps {
pteScore: {
listening: number
reading: number
speaking: number
writing: number
}
}

const PTEAcademicTable = (props: PTEAcademicTableProps) => {
const { pteScore } = props
const scoreList: {
name: 'Listening' | 'Speaking' | 'Reading' | 'Writing'
score: number
ieltsCore?: number
}[] = [
{ name: 'Listening', score: pteScore.listening },
{ name: 'Reading', score: pteScore.reading },
{ name: 'Speaking', score: pteScore.speaking },
{ name: 'Writing', score: pteScore.writing },
]

scoreList.forEach((item) => {
const equivalentScore = getEqualScoresOfPTEAcademic(String(item.score), item.name)
item.ieltsCore = equivalentScore?.[`ielts${item.name}`]
})

const scoresComparisonList: {
testName: 'PTE' | 'IELTS'
listening?: number
reading?: number
speaking?: number
writing?: number
}[] = [
{
testName: 'PTE',
listening: pteScore.listening,
reading: pteScore.reading,
speaking: pteScore.speaking,
writing: pteScore.writing,
},
{
testName: 'IELTS',
listening: scoreList[0].ieltsCore,
reading: scoreList[1].ieltsCore,
speaking: scoreList[2].ieltsCore,
writing: scoreList[3].ieltsCore,
},
]

return (
<table className="w-full border-collapse border-y-2 border-slate-400 text-center text-sm">
<thead className="border-b border-slate-400">
<tr>
<th className="border-r border-slate-400"></th>
<th className="px-2">
<div className="flex flex-col items-center justify-center">
<div className="text-xs">Listening</div>
<PiHeadphones className="text-slate-600" />
</div>
</th>
<th className="px-2">
<div className="flex flex-col items-center justify-center">
<div className="text-xs">Reading</div>
<PiBookOpenUser className="text-slate-600" />
</div>
</th>
<th className="px-2">
<div className="flex flex-col items-center justify-center">
<div className="text-xs">Speaking</div>
<PiChatsCircle className="text-slate-600" />
</div>
</th>
<th className="px-2">
<div className="flex flex-col items-center justify-center">
<div className="text-xs">Writing</div>
<PiPenNib className="text-slate-600" />
</div>
</th>
{/* <th className="border-l border-slate-400 px-2">Total</th> */}
</tr>
</thead>
<tbody className="">
{scoresComparisonList.map((item) => (
<tr
key={item.testName}
className="transition-colors odd:bg-blue-100 even:bg-blue-50 hover:bg-slate-300"
>
{item.testName === 'PTE' && (
<td className="border-r border-slate-400 px-2 text-right">
Your PTE Academic score
</td>
)}

{item.testName === 'IELTS' && (
<td className="border-r border-slate-400 px-2 text-right">
Equivalent to IELTS score
</td>
)}

<td>{item.listening}</td>
<td>{item.reading}</td>
<td>{item.speaking}</td>
<td>{item.writing}</td>

{/* <td className="border-l border-slate-400">
{item.testName === 'Points for EE(Without Spouse)' ||
item.testName === 'Points for EE(With Spouse)' ||
item.testName === 'Points for EE(As Spouse)'
? item.listening! +
item.reading! +
item.speaking! +
item.writing!
: ''}
</td> */}
</tr>
))}
</tbody>
</table>
)
}

export default PTEAcademicTable
Loading

0 comments on commit 16c6b0f

Please sign in to comment.