This repository has been archived by the owner on Jan 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "청담 Skill Practice 해킹", | ||
"version": "1.0", | ||
"description": "청담어학원 Skill Practice의 답을 가져옵니다.", | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": ["https://il.chungdahm.com/?std_id=*&sem_id=*&top_cors_id=*&cid=*&g_seq=*&isTest=Y"], | ||
"js": ["script.js"], | ||
"run_at": "document_end" | ||
} | ||
], | ||
|
||
"action": { | ||
"default_popup": "popup.html" | ||
}, | ||
"permissions": [ | ||
"activeTab" | ||
] | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
</head> | ||
<body> | ||
<h2 style="width: 400px">고태경이 만들었습니다.</h2> | ||
<h1>전화번호 : 010-8513-0103</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
var xhr = new XMLHttpRequest(); | ||
|
||
function start() { | ||
try { | ||
run(); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
var button = document.createElement("button"); | ||
} | ||
} | ||
|
||
function run() { | ||
// get the iframe element by its id | ||
var contentsFrame = document.getElementById("contentsFrame"); | ||
|
||
// access the src attribute of the iframe | ||
var iframeSrc = contentsFrame.src; | ||
|
||
|
||
// remove the "?mode=s" parameter from the link | ||
var cleanedLink = iframeSrc.replace("?mode=s", "?"); | ||
|
||
// open a GET request to the cleaned link | ||
xhr.open("GET", cleanedLink); | ||
|
||
// set the response type to "document" | ||
xhr.responseType = "document"; | ||
|
||
// handle the response when it loads | ||
xhr.onload = () => { | ||
// check if the response was successful | ||
if (xhr.status === 200) { | ||
// get the answerLine element by its class name | ||
var answerLineElement = xhr.responseXML.getElementsByClassName("answerLine STRevealGroup")[0]; | ||
|
||
const final = answerLineElement.querySelector('.answerLine.STRevealGroup strong:first-of-type').nextSibling.textContent.trim(); | ||
|
||
// log the HTML code of the answerLine element to the console | ||
alert("정답:\n" + final + "\n고태경이 만든 \"청담 Skill Practice 해킹\" 확장프로그램"); | ||
} else { | ||
// log an error message if the response was unsuccessful | ||
alert("HTTP GET request failed with status", xhr.status); | ||
} | ||
}; | ||
|
||
// send the HTTP request | ||
xhr.send(); | ||
} | ||
|
||
|
||
var button = document.createElement("button"); | ||
button.innerHTML = "답 보기"; | ||
button.addEventListener("click", start); | ||
button.style.backgroundColor = "blue"; | ||
button.style.color = "white"; | ||
button.style.fontSize = "16px"; | ||
button.style.padding = "10px 20px"; | ||
document.body.appendChild(button); | ||
|