-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cses problem url support added #55
base: main
Are you sure you want to change the base?
Changes from 2 commits
b5e35ad
e155ad8
cd270be
fdd311d
f4bd618
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ import { TabsContext } from "service/TabsContext"; | |
import Url from "url-parse"; | ||
import { useParams } from "react-router-dom"; | ||
|
||
|
||
|
||
interface AppProps { | ||
companies: LabelType[]; | ||
tags: LabelType[]; | ||
|
@@ -75,16 +77,32 @@ const ProblemList: React.FC<AppProps> = ({ | |
.then((res: AxiosResponse<QuestionListResponse[]>) => setResponse(res.data)); | ||
}, []); | ||
|
||
(function () { | ||
var script = document.createElement("script"); | ||
script.type = "text/javascript"; | ||
script.src = "https://cses.fi/lib/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; // use the location of your MathJax | ||
|
||
var config = 'MathJax.Hub.Config({' + | ||
'extensions: ["tex2jax.js"],' + | ||
'jax: ["input/TeX","output/HTML-CSS"]' + | ||
'});' + | ||
'MathJax.Hub.Startup.onload();'; | ||
|
||
script.text = config; | ||
|
||
document.getElementsByTagName("head")[0].appendChild(script); | ||
})(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this function, because it will create a new script with every render, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I just forgot to remove my earlier code that was not working |
||
const { filterResponseData, handleScrappedData } = useContext(TabsContext) as TabsContextTypes; | ||
const { id } = useParams<Record<string, string>>(); | ||
|
||
const NextButton = () => { | ||
const getQuestionData = async () => { | ||
const { hostname } = new Url(url); | ||
if (hostname !== "codeforces.com" && hostname !== "atcoder.jp") { | ||
if (hostname !== "codeforces.com" && hostname !== "atcoder.jp" && hostname !== "cses.fi") { | ||
setErrorText({ | ||
error: true, | ||
comment: "Domain should either be codeforces or atcoder", | ||
comment: "Domain should either be codeforces/atcoder/CSES problem set", | ||
}); | ||
} else { | ||
const { data }: AxiosResponse<{ error: boolean; htmlString: string }> = await axios({ | ||
|
@@ -162,7 +180,7 @@ const ProblemList: React.FC<AppProps> = ({ | |
<> | ||
<Grid container className={styles.root}> | ||
<Grid item className={styles["request-field"]}> | ||
<label>Enter Codeforces Or Atcoder Question URL:</label> | ||
<label>Enter Codeforces/ Atcoder/ CSES Problem Set Question URL:</label> | ||
<CssTextField | ||
onChange={(e) => { | ||
setUrl(e.target.value as string); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to remove unwanted spaces