Skip to content

Instantly share code, notes, and snippets.

@harrydrippin
Last active June 13, 2017 07:04
Show Gist options
  • Save harrydrippin/b3a1d5d235daa51704198075d3be9f5a to your computer and use it in GitHub Desktop.
Save harrydrippin/b3a1d5d235daa51704198075d3be9f5a to your computer and use it in GitHub Desktop.
"(친구)의 성격을 얼마나 잘 알고 있나요?" 정답 분석 스크립트
/*
* Heroquizz "(친구)를 얼마나 잘 알고 있나요?" 분석 스크립트
* @author Seunghwan Hong (@harrydrippin)
*/
/* 사용 방법
* 1. 친구 페이스북에 링크된 "(이름)을 얼마나 잘 알고 있나요?" 링크를 클릭합니다.
* 2. "준비!" 버튼을 누르고, 만약 페이스북 인증을 요구하면 인증을 진행합니다.
* 3. 1번 문제가 뜨면 개발자 도구를 띄웁니다. (Chrome에서 Ctrl + Shift + I (Mac에서는 Cmd + Option + I))
* 4. Console, 혹은 콘솔을 찾고 그 하단에 아래 소스(둘 중 아무거나 괜찮음)를 복사하여 넣고 Enter를 칩니다.
* 5-1. 분석이 진행되며, 뜨는 창에서 "확인(Confirm)"를 누르면 자동으로 모두 정답 처리됩니다.
* 5-2. 적당히 점수를 조절하고 싶다면, "취소(Cancel)"를 누르고 콘솔에 뜬 분석 결과를 토대로 직접 문제를 풀면 됩니다.
*/
/* 원본 소스 */
(function() {
var cmd = "";
for (var i = 1; i <= q_total_need; i++) {
var cur = $('#r' + i + "_1");
var answer = cur.attr("onclick").slice(-2, -1);
console.log(i + "번째 문제 답 : " + answer + "번, " + $('#r' + i + "_" + answer).text().trim());
var answer_cmd = $('#r' + i + "_" + answer).attr("onclick").split(",");
cmd += answer_cmd[2].trim() + "," + answer + "|";
}
if (confirm("분석 결과가 개발자 도구 > 콘솔에 표시되었습니다. 모든 문제를 정답으로 자동 처리할까요?")) {
document.location.href='/go/807138599417140/767?r=' + location.pathname.split("/")[2] + '&data=' + cmd;
}
}())
/* Minified 소스 */
!function(){for(var t="",o=1;o<=q_total_need;o++){var r=$("#r"+o+"_1"),a=r.attr("onclick").slice(-2,-1);console.log(o+"번째 문제 답 : "+a+"번, "+$("#r"+o+"_"+a).text().trim());var c=$("#r"+o+"_"+a).attr("onclick").split(",");t+=c[2].trim()+","+a+"|"}confirm("분석 결과가 개발자 도구 > 콘솔에 표시되었습니다. 모든 문제를 정답으로 자동 처리할까요?")&&(document.location.href="/go/807138599417140/767?r="+location.pathname.split("/")[2]+"&data="+t)}();
@harrydrippin
Copy link
Author

Chrome에서는 동작 보장이 되어있으나, Internet Explorer에서는 될 수도 있고 안될 수도 있습니다. 가급적이면 Chrome에서 진행해주세요! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment