Path: blob/master/scripts/quizlet_match.js
853 views
(function () {1const matches = {};2Quizlet.matchModeData.terms.forEach((term) => {3matches[term.word] = term.definition;4});5let css = "FormattedText notranslate TermText MatchModeQuestionGridTile-text";6if (document.getElementsByClassName(css).length === 0)7css = "MatchModeQuestionScatterTile";8const tiles = Array.from(document.getElementsByClassName(css));9const colors = [10"#f93640",11"#f98836",12"#f9e936",13"#3df936",14"#36f9d9",15"#3650f9",16"#7e36f9",17"#dc36f9",18"#ffffff",19"#a3a3a3",20"#424242",21];22Array.from(23document.getElementsByClassName("MatchModeQuestionGridTile-image")24).forEach((image) => {25image.style.display = "none";26});2728let colorIndex = 0;29for (const term in matches) {30const definition = matches[term];31tiles.forEach((tile) => {32if (tile.textContent === term) {33tiles.forEach((box) => {34if (box.textContent === definition) {35box.style.background = colors[colorIndex];36box.style.color = "black";37}38});39tile.style.background = colors[colorIndex];40tile.style.color = "black";41colorIndex++;42}43});44}45})();464748