Skip to content

Commit

Permalink
ボタンデザインを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mongolyy committed Aug 17, 2021
1 parent 70c2e36 commit 44a1f05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 2 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"32": "/images/icon.png"
},
"content_scripts": [{
"matches": ["https://www.udemy.com/course/*/learn/quiz/*/result/*"],
"js": ["script.js"],
"run_at": "document_end",
"all_frames": true
"matches": ["https://www.udemy.com/course/*/learn/quiz/*"],
"js": ["script.js"]
}]
}
15 changes: 11 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
function show() {
document.querySelectorAll("[class^='mc-quiz-answer--correctness--']").forEach(element => element.style.display = 'block');
document.querySelectorAll("[class*='mc-quiz-answer--answer-body--'][class*='mc-quiz-answer--correct--']").forEach(element => element.style.backgroundColor = '#f2f7f6');
document.querySelectorAll("[class*='mc-quiz-answer--answer-body--'][class*='mc-quiz-answer--correct--']").forEach(element => element.style.backgroundColor = '#d4eae0');
document.querySelectorAll("[class^='mc-quiz-question--explanation--']").forEach(element => element.style.visibility = 'visible');
}

Expand All @@ -15,16 +14,24 @@ const main = () => {

const jsLoaded = () => {
if (document.querySelector("[class^='detailed-result-panel--panel-row--']") !== null) {
clearInterval(jsInitCheckTimer)
hide()
clearInterval(jsInitCheckTimer);
hide();

document.querySelectorAll("[class^='detailed-result-panel--panel-row--']").forEach(element => {
const showButton = document.createElement('button');
showButton.innerText = 'show answer';
showButton.type = 'button';
showButton.style.width = '150px';
showButton.style.borderRadius = '5px';
showButton.style.borderWidth = '1px';
showButton.onclick = show;

const hiddenButton = document.createElement('button');
hiddenButton.innerText = 'hide answer';
hiddenButton.type = 'button';
hiddenButton.style.width = '150px';
hiddenButton.style.borderRadius = '5px';
hiddenButton.style.borderWidth = '1px';
hiddenButton.onclick = hide;

const formNode = element.querySelector('form');
Expand Down

0 comments on commit 44a1f05

Please sign in to comment.