Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
tkgo11 authored Feb 19, 2023
1 parent 6db4b51 commit 2a1e80c
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
23 changes: 23 additions & 0 deletions manifest.json
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"
]

}

10 changes: 10 additions & 0 deletions popup.html
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>
60 changes: 60 additions & 0 deletions script.js
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);

0 comments on commit 2a1e80c

Please sign in to comment.