zsx

zsx

先作为主站备份 源站:https://my.toho.red

Recalling a Battle with a Certain Online Course System

This morning, when I was visiting relatives, my family planned to go out and have fun with them, but I wanted to stay at home and not go out. So my relatives gave me a task: to help them complete online course assignments. If it was just about watching the courses, I could just leave it alone. Why did they need someone to watch over it? That's what I initially thought, but this system has a very annoying feature: it pops up a question every 10 minutes or so, and if you don't answer the question, it will keep pausing, so you can't keep watching without interruption. But I couldn't possibly watch the online courses seriously, and I didn't like the feeling of sitting in front of the computer and answering questions every few minutes. So I started to figure out a way to solve this problem once and for all.

Since the client is on the web, the first thing I needed to do was to press F12 to see how the pop-up was implemented. Then I found this:
![Capture.PNG][1]
Just by looking at this, with my limited knowledge of JavaScript, I already understood the basic principle: create a variable to store the number of seconds played, increment it every 1 second, and then when the variable reaches a certain value, a question will pop up. I looked at the backend and it was indeed similar to what I expected:
![Capture.PNG][2]
At first, I wanted to directly define the values in the console, but I found that even if I defined all the values as 0, the questions would still pop up as usual. It seems that this approach won't work, the variables defined in the console are not the same as the ones read by the webpage.

When I wanted to continue my research, I scrolled down and found this:
![Capture.PNG][3]
When I saw this piece of code, I thought I had found the ultimate solution, so I started working on it right away. But whether I directly executed this method in the console or wrote a script to directly post to this interface, refreshing the course list still showed it as incomplete. It could be because the server has a time verification algorithm, or it could be because I didn't study the script carefully enough, but no matter what, this approach won't work. I'm not a JavaScript expert, so I can't understand all the code. So I had to take the last approach: directly modify the code to disable the timer.

After searching for a while, I found that Chrome has a way to directly replace webpage content. The specific steps are as follows:

Press F12 to enter the "Sources" page, click on "Overrides", and select "Enable Local Overrides":
![Capture.PNG][4]
I have already added it here. If it's your first time adding it, it will display "Select a folder to place overrides". Just create a new folder and select it. After selecting it, it will prompt for permission, just allow it.

After completing this step, I found that the source code displayed by F12 can be directly edited. So I started to transform the timer like this:
![Capture.PNG][5]
Press Ctrl+S to save, and then refresh the webpage. The console will look like this:
![Capture.PNG][6]
After testing, this modification successfully achieved the goal. Not only did it stop the pop-up questions, but the course list also showed as completed after watching the video.

Finally, I can put down my computer and enjoy browsing other websites.

2022.3.6
[1]: https://my.toho.red/usr/uploads/2022/03/98944978.png
[2]: https://my.toho.red/usr/uploads/2022/03/1414410636.png
[3]: https://my.toho.red/usr/uploads/2022/03/4248933191.png
[4]: https://my.toho.red/usr/uploads/2022/03/1057079627.png
[5]: https://my.toho.red/usr/uploads/2022/03/2544401216.png
[6]: https://my.toho.red/usr/uploads/2022/03/496899477.png

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.